clear % L4 p 17 A={'sin(x)','x.^2.*sin(x)','exp(sin(x))'} x=0:0.01:2*pi; mycolor={'blue','cyan','magenta'} currentwidth=[1,2,5] leg={} for f=A k=1 while ~strcmp(A{k},f{:}) k=k+1 end r=plot(x,eval(f{:})) set(r,'color',mycolor{k},'linewidth',currentwidth(k)) leg=union(leg,f{:}) hold on end grid on l=legend(leg{:}), set(l,'fontsize',12) set(l,'location','best') % add comment