I'm new to MatLab (so please excuse my language) and am attempting to overlay two line plots of vectors, as coded here (actual vectors a and b are 50 elements long):
a = [1, 2, 3]b = [1, 3, 2]compPlot = figure('Name', 'Comparison of stuff');ax1 = axes('Parent', compPlot);plot(ax1, a, 'Color', 'blue');plot(ax1, b, 'Color', 'red');title(ax1, 'Figure 3: Plot of stuff');
Basically, I'd like the blue and red lines to show up on the same graph. I know I can use a 'hold on' statement to plot them, but I was hoping to do it thru a "figure" statement since that seemed more elegant (and seems to make adjusting options easier and seems to be the more advanced and powerful way to do it).
Is there a way to do it using the plot(ax,…) method?
Thanks, Ben
Best Answer