How to plot polynomial in matlab
15 ビュー (過去 30 日間)
古いコメントを表示
equation is f(x) = 150x - 400x^2 + 500x^3
Want to plot f(x) for x= 0 to 0.8
need to have a legend
4 件のコメント
Dyuman Joshi
2024 年 3 月 3 日
You need to use element-wise power - power, .^
epsilon = linspace(0,0.8,100);
sigma = 150*epsilon - 400*epsilon.^2 + 500*epsilon.^3;
figure;
plot (epsilon, sigma)
xlabel('Strain(ε)');
ylabel('Stress(σ)(kPa)');
title('Stress/Strain for Foam');
grid on;
回答 (1 件)
Alexander
2024 年 2 月 29 日
編集済み: Alexander
2024 年 2 月 29 日
Some homework assistance and solution:
x = linspace(0,0.8,1000);
y = 150*x - 400*x.^2 + 500*x.^3;
plot(x,y)
1 件のコメント
Dyuman Joshi
2024 年 2 月 29 日
編集済み: Dyuman Joshi
2024 年 2 月 29 日
I believe that's solving the problem rather than assisting.
I suggest you edit your answer accordingly.
参考
カテゴリ
Help Center および File Exchange で Function Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!