matlab plotting multiple lines on one graph

To plot multiple lines on one graph in MATLAB, you can use the plot function multiple times with different sets of data. Here's an example:

x = 0:0.1:10; % x-axis values
y1 = sin(x); % y-values for line 1
y2 = cos(x); % y-values for line 2

plot(x, y1) % plot line 1
hold on % enable the "hold on" feature to add more lines to the plot
plot(x, y2) % plot line 2

% Add labels and a legend
legend('Line 1', 'Line 2')

In this example, the x variable represents the x-axis values, while y1 and y2 represent the y-axis values for line 1 and line 2, respectively. The plot function is used to plot each line, and the hold on command ensures that subsequent plot calls don't overwrite the previous lines. Finally, the xlabel, ylabel, and legend functions are used to add labels and a legend to the plot.

You can modify the data and customize the plot as per your requirements.