how do you plot 3 similar data sets on the same graph in different colors in MATLAB?

648 Views Asked by At

How do I plot the following data in the same figure using MATLAB?

enter image description here

Frequency is measured in Hertz (Hz) and should be horizontal axis. Fall Time is measured in microseconds (us) and should be vertical axis.

freq1 goes with falltime1 freq2 goes with falltime2 freq3 goes with falltime3

They should all be in different colors and the graph should have a legend.

How can I achieve this in MATLAB?

1

There are 1 best solutions below

0
Molly On BEST ANSWER

The hold on command is probably what you want.

figure
hold on
plot(freq1, falltime1, 'r-o') % plot in red, circles connected with lines
plot(freq2, falltime2, 'g-o') % plot in green, circles connected with lines
plot(freq3, falltime3, 'b-o') % plot in blue, circles connected with lines
legend('1', '2', '3') % legend text
xlabel('Hertz (Hz)')
ylabel('Fall Time (\mus)')

plot of three data sets on the same figure