Integration of a function multiplied by an array
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all,
I want to integrate a symbolic function which is multiplied by a vector, for example:
syms x
y1 = linspace(0,1,10);
y2 = @(x) x.*y1;
q = integral(y2,0,1);
However, the integral execution fails due to 'Matrix dimensions must agree.'.
Is there a solution for this?
Thanks!
Ron
0 件のコメント
採用された回答
Abolfazl Chaman Motlagh
2021 年 12 月 8 日
your y2 function return Array for every single number as it's input.
syms x
y1 = linspace(0,1,10);
y2 = @(x) x.*y1;
y2(1)
according to documentation of integral function if fun has Array output, you should use option ArrayValued:
q = integral(y2,0,1,'ArrayValued',true)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!