MATLAB: ‘legend’ problem

'legend' problem

Hello,
I'm using hold on to draw different vectors on the same graph but every time I add a curve I need to add its legend. My problem is that when I write 'legend('Curve Name')' it appears only the last and I'd need to see all the names together$ on the same legend.
Thank you very much
Silvia

Best Answer

Dear Silva,
The best way is that when you plot give the name to the curve instantly. let say
plot([1:10],'Color','r','DisplayName','Vector 1');hold on;
plot as many vectors you want. Just in end type this.
legend('show');
Related Question