hello,
I have this code:
close allx=[0,1,2,3,4,5]x1=sin(x)p1=x1(2)p2=x1(3)x3=cos(x)p4=x3(2)p5=x3(3)figure(1)plot(x1)hold allplot([2],[p1],'o')plot([3],[p2],'o')plot(x3)plot([2],[p4],'o')plot([3],[p5],'o')k=2 for k=1:k ls1=[num2str(k),'.Q'] ls2=[num2str(k),'.SR'] ls3=[num2str(k),'.r'] endlegend(ls1,ls2,ls3)
and I would like to fix the legend. I want my program to tell me that the 6 legend variables are: 1.Q,1.SR,1.r,2.Q,2.SR,2.r
Right now the program is overwriting the outcome of the for loop.
How do I do this?
Thank sou yo much!
Best Answer