Overlapping graphs in figure
4 ビュー (過去 30 日間)
古いコメントを表示
Diego Núñez García
2021 年 7 月 5 日
コメント済み: Sulaymon Eshkabilov
2021 年 7 月 6 日
Here is part of my code. I'm ploting two graphs evaluating several polynomials , I use "delete(gca) and clf " at the begining of the code, but when I run the script with another vaules, I receive in figure(1) the last plot and the actual one.
i=0
figure(1)
hold on
for i=1:length(nodos)-1
plot([nodos(i):0.01:nodos(i+1)],polyval([Mx(:,:,i)],[nodos(i):0.01:nodos(i+1)]),'Color','b','LineWidth',2.5)
hold on
end
xlabel('Longitud de la Viga [m]')
ylabel('Fuerza cortante[N]')
yline(0)
i=0
figure(2)
for i=1:length(nodos)-1
plot([nodos(i):0.01:nodos(i+1)],polyval([Vx(:,:,i)],[nodos(i):0.01:nodos(i+1)]),'Color','b','LineWidth',2.5)
hold on
end
xlabel('Longitud de la Viga [m]')
ylabel('Momento Flector [n*M]')
yline(0)

1 件のコメント
Image Analyst
2021 年 7 月 5 日
Well, we don't have nodos, Vx, and Mx so it's hard for us to reproduce your code or fix it. Please attach your variables in a .mat file with the paperclip icon after you read this:
To save your variables in a .mat file, do this:
save('answers.mat', 'nodos', 'Mx', 'Vx');
採用された回答
Sulaymon Eshkabilov
2021 年 7 月 5 日
Here is a bit edited and corrected code:
figure()
for i=1:length(nodos)-1
plot([nodos(i):0.01:nodos(i+1)],polyval([Mx(:,:,i)],[nodos(i):0.01:nodos(i+1)]),'-','LineWidth',2.5)
hold on % Different colored lines
end
xlabel('Longitud de la Viga [m]')
ylabel('Fuerza cortante[N]')
yline(0)
figure()
for i=1:length(nodos)-1
plot([nodos(i):0.01:nodos(i+1)],polyval([Vx(:,:,i)],[nodos(i):0.01:nodos(i+1)]),'-','LineWidth',2.5)
hold all % % Different colored lines
end
xlabel('Longitud de la Viga [m]')
ylabel('Momento Flector [n*M]')
yline(0)
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!