How to go through each element of a vector without a for loop
26 ビュー (過去 30 日間)
古いコメントを表示
Jesus Alejandro Rodriguez Morales
2020 年 9 月 18 日
コメント済み: Jesus Alejandro Rodriguez Morales
2020 年 9 月 18 日
I would like to write the following code without a for loop. Thanks in advance!
function fh = poly_fun(p)
function polynomial = poly(x)
polynomial = 0;
for ii = 1:length(p)
polynomial = polynomial + p(ii) .* x.^(ii-1);
end
end
fh = @poly;
end
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!