Using Matlab write a code for the following: Us the numbers below, I can\'t uplo
ID: 2080088 • Letter: U
Question
Using Matlab write a code for the following:
Us the numbers below, I can't upload the the file use to the load function but these are the numbers that are being ran. I need help with the code, to the point all I have to enter is the actual file name
24551.00 24582.00 25132.00 26553.00 26613.00 26615.00 26619.00 26624.00 27725.00 28151.00 28189.00 29551.00 30003.00 31503.00 32553.00 35001.00 37191.00 38091.00 39099.00 38091.00 40099.00 41091.00 42000.00 43001.00 45500.00 48000.00 55 500.00 58000.00 55555.00 68000.00 145.50 153.70 120.50 160.40 159.50 160.00 150.30 160.50 170.90 160.30 160.30 170.10 160.40 165.10 145.50 155.50 170.00 179.00 162.00 150.00 165.00 155.00 205.00 255.00 25.00 255.00 160.00 165.00 165.00 175.00 62.30 63.00 90.30 58.80 58.90 60.00 69.30 61.50 62.50 40.20 40.20 49.30 58.80 68.20 62.30 67.30 60.00 90.00 90.00 60.00 67.00 60.00 75.00 60.00 55.00 70.00 60.00 70.00 60.00 70.50 2.13 2.52 1.31 2.51 2.02 2.20 2.40 1.98 2.83 2.19 2.19 3.19 2.51 2.12 2.13 2.13 2.50 2.50 4.50 2.00 1.85 2.10 1.85 2.10 2.85 2.10 3.85 2.10 2.05 2.10Explanation / Answer
Batchno=x(:,1);
Temp=x(:,2);
Pressure=x(:,3);
Time=x(:,4);
Totalbatches=length(Batchno);
%% 1. Script to compute and print the percentage of batches rejected
BatchrejTemp1=Temp(Temp<150);
BatchrejTemp2=Temp(Temp>170);
rejBatchTemp=length(BatchrejTemp1)+length(BatchrejTemp2);
rejBatchTempPer=(rejBatchTemp/Totalbatches)*100;
fprintf('Total no of batches rejected due to Temperature failure: %d ',rejBatchTemp);
fprintf('Percentage of batches rejected due to Temperature failure: %f ',rejBatchTempPer);
BatchrejPressure1=Pressure(Pressure<60);
BatchrejPressure2=Pressure(Pressure>70);
rejBatchPressure=length(BatchrejPressure1)+length(BatchrejPressure2);
rejBatchPressurePer=(rejBatchPressure/Totalbatches)*100;
fprintf('Total no of batches rejected due to Pressure failure: %d ',rejBatchPressure);
fprintf('Percentage of batches rejected due to Pressure failure: %f ',rejBatchPressurePer);
BatchrejTime1=Time(Time<2);
BatchrejTime2=Time(Time>2.5);
rejBatchTime=length(BatchrejTime1)+length(BatchrejTime2);
rejBatchTimePer=(rejBatchTime/Totalbatches)*100;
fprintf('Total no of batches rejected due to DwellTime failure: %d ',rejBatchTime);
fprintf('Percentage of batches rejected due to DwellTime failure: %f ',rejBatchTimePer);
%% 2.
Batchnew=[0];Data=[0 0 0 0];
for i=1:Totalbatches
if Temp(i)>=150 && Temp(i)<=170
if Pressure(i)>=60 && Pressure(i)<=70
if Time(i)>=2 && Time(i)>=2.5
Batchnew=[Batchnew;Batchno(i)];
Datanew=[Batchno(i) Temp(i) Pressure(i) Time(i)];
Data=[Data;Datanew];
end
end
end
i=i+1;
end;
Batcheserror=Batchnew(2:end);
fprintf('Batches entered erroneously are: %d ',Batcheserror);
%% 3.
Data=Data(2:end,:); % this is the file of batches that are erroneously deleted
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.