Summing integrands in a loop
古いコメントを表示
I want to integrate the following expression:
A = x + x^2 + x^3;
How can one do it using a for loop? For instance, I am trying something like as follows:
for k = 1:1:3
fun1{k} = @(x)(x.^k);
end
A_sum = cellfun(@sum,fun1{k});
int = integral(A_sum, 0, 1)
But this results in an error.
I know that the above expression can be evaluated easily without using a for loop. But the actual expression that I want to evaluate contains the summation of about 200 complex terms.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および 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!