Info

この質問は閉じられています。 編集または回答するには再度開いてください。

help with algorithm please

3 ビュー (過去 30 日間)
Antwone Goodwyn
Antwone Goodwyn 2019 年 5 月 6 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Develop M-file that can do followings
- Ask you to input the functions f1(x)=x.^2; f2(x)=x.^3; where x is -100, -99, -98........, 99, 100
- Find and plot fsum(x)=f1(x)+f2(x)
What i could come up with
ni=0
nf=100
for x=ni+nf;
f1(ni)=ni^2;
f2(nf)=nf^3;
fsum(x)=f1(ni)+f2(nf);
end
plot(fsum);
  3 件のコメント
David Wilson
David Wilson 2019 年 5 月 6 日
You also might want to use vectors, say something like
ni = -100:100;
f1 = ni.^2;
f2 = ni.^3;
fsum = f1+f2
and you can plot the result.
Walter Roberson
Walter Roberson 2019 年 5 月 6 日
input() with the 's' option, and str2func

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by