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

Please use MATLAB. Thank you! (11 Points) Write code (no need to create a functi

ID: 3700589 • Letter: P

Question

Please use MATLAB.

Thank you!

(11 Points) Write code (no need to create a function) to plot the data in points. This array consists of pairs of numbers that represent each point. Each point (ie, pair of numbers) is connected to the next point (pair of numbers). Note, the last point is also connected to the first. Draw the lines in red. (-10 lines of code) For example, if points is [ 0,0. 5.5, 0.10 ], then three lines would be displayed: i. (0, 0) to (5, 5); . (5, 5) to to (0.0) You may nly cal/ the plot function once.

Explanation / Answer

// The MATLAB code as you desired

X = [0,0,5,5,0,10];
% to display as you desired
A= [ 'i. (', num2str(X(1)), ',',num2str(X(2)), ') to (', num2str(X(3)), ',',num2str(X(4)), ');'];
B= [ 'ii. (', num2str(X(3)), ',',num2str(X(4)), ') to (', num2str(X(5)), ',',num2str(X(6)), ');'];
Z= [ 'iii. (', num2str(X(5)), ',',num2str(X(6)), ') to (', num2str(X(1)), ',',num2str(X(2)), ');'];

disp(A)
disp(B)
disp(Z)

%to convert into two points as array
Q = [X(1) X(2)];
R = [X(3) X(4)];
S = [X(5) X(5)];

% for plotting data points
hold on
plot(Q,R,'r')

plot (R,S,'r')

plot(S,Q,'r')


% use the plot function over here as you desired
% Basically my Matlab got hanged while I am working on your solution, So I am providing you the code
% Thank you