How to plot a function with e^-x?

3 ビュー (過去 30 日間)
Anelisse Meriles
Anelisse Meriles 2020 年 4 月 5 日
コメント済み: Anelisse Meriles 2020 年 4 月 5 日
Hello, I'm trying to plot functions f(x)=100*x^2 and f(x) = 100*x^2*e^-x with time vectors from 0 to 5. I keep getting errors on my function.What is the right way to insert this function in Matlab?
This is my logic:
x = 0 : 0.1 : 5;
y = (100)*(x.^2);
hold on
g = 100*(x.^2)*exp(-x);
plot(x,y,'r',x,g,'b')
grid on

採用された回答

David Hill
David Hill 2020 年 4 月 5 日
g = 100*(x.^2).*exp(-x); %looks good, just need .* The rest should work
  1 件のコメント
Anelisse Meriles
Anelisse Meriles 2020 年 4 月 5 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by