How to generate a legend with different values inside a loop
显示 更早的评论
I am trying to put in the legend the values of E for each graph. So for i=0 I would like to have in the legend the value of E=50000. This is the code I have so far:
for i=0:25000:150000
x = 0 : 0.25 : 5
E = 50000 + i
y = (4*E.*x)/((1-nu^2)*D_e^2*N).*((h-x).*(h-x/2)*t+t^3)
plot(x,y,'DisplayName','E')
xlabel('Displacement(mm)')
ylabel('Force(N)')
hold on
lgd = legend;
lgd.NumColumns = 2;
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!