Search code examples
matlabgraphplotlinegraph

How to plot two lines in one graph in MATLAB?


suppose i have X={0,5.4,6.18,6.81,6.85,6.95,6.96,7.20,7.51} and

Y={0,4.84,5.52,6.00,6.12,6.21,6.23,6.34,6.61}.please help me to plot two lines

with these points in one single graph using MATLAB.Thanks


Solution

  • You can also do:

    x_axis_X = 1:length(X);
    y_axis_Y = 1:length(Y);
    
    figure;plot(x_axis_X, X,'o-', y_axis_Y, Y, 'x-');