Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Form the 3 row data-set containing the following data using linspace(),\' and

ID: 2263365 • Letter: 1

Question




1. Form the 3 row data-set containing the following data using linspace(),' and'. Save it as 'A 9 10 2 150 200 5 4 250 300 9 350 400 450 500 550 19 100 13 15 17 2. Extract all the three rows and save them in variables 'A1', 'A2' and 'A3' as column vectors Combine column vectors 'A2' and 'A3' into a new matrix 'B' Plot both the columns of 'B' versus 'A1', first using hold function and then again in a separate figure window using subplot() 3. 4. 5. Using one single plot command, plot 'B' v/s A1'. Add labels, title, legend and properties 6. Create a new matrix 'C' combining 'A1' and 'B'. Save this matrix 'C' in a.*txt file of your choice

Explanation / Answer


clc;
clear all;
A=[linspace(1,10,10); 100:50:550 ; linspace(1,19,10)]
A1=A(1,:)
A2=A(2,:)
A3=A(3,:)
B=[A2;A3]
figure(1)
plot(B(1,:))
hold on
plot(B(2,:))
hold off
figure(2)
for i = 1:size(B)
subplot(2,2,i)
plot(B(i,:))
end
figure(3)
plot(A1,B,'*')
title('B vs A1')
xlabel('A1')
ylabel('B')
legend('A2','A3')
C=[A1;B]
dlmwrite('filename.txt',C)