MATLAB: Adding a undepending line to legend of plot

adding undependen lineslegend

Hello,
I want to plot a graphic to compare Measurments and Simulations
therefore I want to display a black line which is point out wich of the data is measurment and which is simulation
I added an example of my plot without the described lines

Best Answer

  • Hey,
    the solution I found now is very simple and not so nice but it works for me.
    plot(x1,y1,'LineWidth',1.5,'Color','b')
    plot(x2,y2,'LineWidth',1.5,'Color','r')
    plot(0,0,'-','Color','k')
    plot(0,0,'--','Color','k')
    plot(x3,y3,'--','LineWidth',2,'Color','b');
    plot(x4,y4,'--','LineWidth',2,'Color','r');
    hl=legend(name_a,name_b,'Simulation','Measurement','Location','southeast')