Issue with plotting. I put it in a vector but it returns a scalar once it goes through the calculation
1 回表示 (過去 30 日間)
古いコメントを表示
Hi everyone
I wanted to plot this program. My N ranges from 1 to 60 and the function is set below it. However it only runs when N=60. Like i don't get a vector from er
%%%%%%%%%%%
x = 10;
N = [1:60]
sumN = x.^N/factorial(N);
er =abs(sumN-exp(x))/exp(x);
plot(N,er,'*')
0 件のコメント
採用された回答
Tommy
2020 年 4 月 4 日
Add a dot before the division symbol in the third line for element-wise division:
x = 10;
N = [1:60]
sumN = x.^N./factorial(N);
er =abs(sumN-exp(x))/exp(x);
plot(N,er,'*')
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!