I am trying to create a chart with 2 legend boxes but the first time I call the legend function it disregards that and only creates the second one. I'm not sure what I am doing wrong or how to fix this.
Here is my code:
% Plotting graphs on the same x with different y
yyaxis left
plot(x, y3)
xlabel('x (between 0 and 2pi)')
ylabel('2sin(x)cos(x)')
legend('2sin(x)cos(x)', "Location", "NorthWest")
yyaxis right
plot(x, y4)
ylabel('sin(x)cos(x)')
legend('sin(x)/cos(x)', "Location", "NortEast")
This gives the following output:
Which as you can see is not even the right legend for the graph. Black is supposed to be 2sin(x)cos(x).
I am using MATLAB R2020b by the way.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…