Matlab? Im struggling with while and for loops. can anyone help me with write th
ID: 3673212 • Letter: M
Question
Matlab? Im struggling with while and for loops. can anyone help me with write the code?
With out using and Intrinsic functions or logical/relational operators. To do this you will need to frist write and if statement nested inside a for loop to find all trash types that satify the first condition. Then, you will need to write your own maximum function to find which trash type has the maximum green house gas emissions. The only intrinsic function that is allowed is "length".
this is all the data.....
mindist=[2.71 4.25 0.92 0.03 0.79 1.22 4.84 1.16]; %km
maxdist=[84.07 248.54 269.4 283.54 294.96 515.89 3975.58 6115.71]; %km
avdist=[18.4 79.46 101.24 27.15 46.33 92.36 1246.15 1713.57]; %km
time=[500 30 300 450 5000 15 100 100]; %years
ghg=[0.001 0.004 0.005 0.001 0.002 0.005 0.066 0.091]; %MTCE/us ton
types={'Glass bottle', 'Furniture', 'Computer', 'Plastic Bottle', 'Styrofoam', 'Wood', 'Lithium battery', 'Printer cartridge.'};
Explanation / Answer
while 1
mindist=[2.71 4.25 0.92 0.03 0.79 1.22 4.84 1.16]; %km
maxdist=[84.07 248.54 269.4 283.54 294.96 515.89 3975.58 6115.71]; %km
avdist=[18.4 79.46 101.24 27.15 46.33 92.36 1246.15 1713.57]; %km
time=[500 30 300 450 5000 15 100 100]; %years
ghg=[0.001 0.004 0.005 0.001 0.002 0.005 0.066 0.091]; %MTCE/us ton
types={'Glass bottle', 'Furniture', 'Computer', 'Plastic Bottle', 'Styrofoam', 'Wood', 'Lithium battery', 'Printer cartridge.'};
end