Write a MATLAB program for 2-D plot graph with title, legend, label



Code:

clc;
x = 0:0.01:2*pi;
y = sin(x);
z = cos(x);
figure
plot (x,y,x,z);
xlabel ('X values');
ylabel ('Y values');
title ('Sample Plot');
legend ('x data','y data');
gridon;


Output:


No comments

Powered by Blogger.