MATLAB HELP please You are analyzing the performance of two
MATLAB HELP please
You are analyzing the performance of two machines making integrated circuits. Write a function to accept a matrix with two columns containing data about defects produced by each machine.
• Column 1 contains the number of defective parts from Machine A.
• Column 2 contains the number of defective parts from Machine B.
• Each row represents the defects on a specific date.
Your function should return a two-element row vector named perform. The first element should contain the number of days Machine A produced fewer defective parts than Machine B, and the second element should contain the number of days Machine B had fewer defects.
Solution
TYPE THE FOLLOWING CODE IN MATLAB M-FILE AND SAVE IT WITH NAME \"performance\"
function [perform]=performance(M)
k=0;
l=0;
t=size(M);
for i=1:(t(1,1))
if(M(i,1)<M(i,2))
k=k+1;
end
if(M(i,1)>M(i,2))
l=l+1;
end
end
perform=[k l];
NOW CREATE ANOTHER M-FILE AND TYPE AS BELOW. \'M\' IS A TWO COLUMN MATRIX FOR MACHINE A AND MACHINE B RESPECTIVELY INDICATING NUMBER OF DEFECTIVE PARTS PRODUCED FOR 5 DAYS
clear all;
clc;
M=[3 4
2 1
1 1
6 1
2 1];
PERFORM=performance(M)
OUTPUT
PERFORM =
1 3
1 INDICATES THAT OUT OF FIVE DAYS 1 DAY MACINE A PRODUCED fewer defective parts than Machine B.
3 INDICATES THAT OUT OF FIVE DAYS 3 DAYS MACINE B PRODUCED fewer defective parts than Machine A.
