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!