Integral of exponential matrix

조회 수: 10 (최근 30일)
Federico Celi
Federico Celi 2020년 6월 19일
댓글: Vince Toonen 2022년 12월 11일
I am looking into integrating a function of the form
where M is a square matrix. It can either be symbolic or not (t is given at the time of computation).
How should I set up the code? I am using expm to compute the exponent, but the integral gives me an error in the multiplication: Matrix dimensions must agree.
M = [1 2; 3 4];
tf = 1;
Qk=integral(@(t) expm(M.*t),0,tf);
I am aware that a similar question was asked here, but I still can't understand the issue.
Thank you!

답변 (1개)

Steven Lord
Steven Lord 2020년 6월 19일
Tell MATLAB your integrand doesn't return a vector the same size as the input but should be called with a scalar and will return an array.
Qk=integral(@(t) expm(M.*t),0,tf, 'ArrayValued', true);
  댓글 수: 2
Federico Celi
Federico Celi 2020년 6월 19일
Brilliant, thank you!
Vince Toonen
Vince Toonen 2022년 12월 11일
Thanks you so much man, I had exactly the same question.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by