Why does my function return a single value instead of an array? I need it to return an array so I can plot it.
9 ビュー (過去 30 日間)
古いコメントを表示
%A.3
Dn2 = @(n) (1-exp(-j*pi*n/2))/(j*pi*n);
n5 = [-5:5];
Y=Dn2(n5)
0 件のコメント
回答 (1 件)
Chunru
2021 年 11 月 17 日
Use ./ instead of / for array operation. [Note that there is division by 0 in your equation]
Dn2 = @(n) (1-exp(-1j*pi*n/2))./(j*pi*n);
n5 = [-5:5];
Y=Dn2(n5)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!