MATLAB: How to input multiple lines on a graph

excelline graph

I imported my data from excel, and i want to compare to different y values on a line graph. How to i add the second y value

Best Answer

In order to place mutliple plot on same figure we can use hold on functionality
As a example
x = linspace(-pi,pi);
y1 = sin(x);
y2 = cos(x);
plot(x,y1); % first line
hold on
plot(x,y2); % second line
hold off