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!