MATLAB: How to add a new entry for legend while running a multiple plot legend entry for each plot % Timeseries Simulation clear all; clc tic x=1:10; Sol=zeros(Nhr,6); for i=1:3 y=i.*x; figure (1), fig1 = plot(x,y); legend(['plot for run ',num2str(i)]) hold on end Best Answer x=1:10;hold onfor ii=1:3 y=ii.*x; fig1 = plot(x,y); legvec{ii} = sprintf('plot for run %d',ii);endlegend(legvec,'Location','northwest')hold off Related SolutionsMATLAB: SUBPLOT : UPPER & LOWER PLOT %truefor i = 1: 6 subplot(6,2,i) y = cos(i*x); plot(x,y) title(sprintf('y = cos(%dx)', i));end MATLAB: How to make a single plot with different colors Hix=1:10;y=1:10;plot(x(1:5),y(1:5),'r')hold onplot(x(5:10),y(5:10),'g') Related QuestionSubplots made by multiple plotsCreate Plot Title of the Plotted FunctionHow to plot graph scalePlot Marker – can it be alphabetical
Best Answer