113) Write a function “plotexvar” that will plot data points represented by the
ID: 3688263 • Letter: 1
Question
113) Write a function “plotexvar” that will plot data points represented by the x and y vectors which are passed as the first two input arguments. If a third argument is passed, it is a color, and if a fourth argument is also passed, it is a line width for the plot. The plot title will include the total number of arguments passed to the function. Suggestion: use set function to change the plot properties. Here is an example of calling the function and the resulting plot: >> x=-pi:pi/50:2*pi; >> y = sin(x); >> plotexvar(x,y, [0.5,0.5,0.5],3)
this is using matlab
Explanation / Answer
samplecode-
function [X,Y,C,W]=plotexvar(a,b,c,d)
X=-pi:pi/50:2*pi;
Y=sin(X);
C='-m*';
W='LineWidth;,2;
figure
plot(X,Y,C,W);
xlabel('X.axis');
ylabel('Y.axis');
title('Four Arguments passed');
end
note- by using above sample with required modifications the given question can be answered.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.