Index exceeds matrix dimensions when solving for ODE system.

조회 수: 9 (최근 30일)
nanana sehaa
nanana sehaa 2017년 9월 27일
댓글: nanana sehaa 2017년 9월 27일
Hi. Im trying to solve this system of equation. But it gives me this error. What does it mean and how to solve this? Thank you.
function dphidz = Pphiode(z,phi,Ro,Eta,Lambda)
Co=2.0-Ro-Ro^2; % Coriolis number
dphidz = [phi(2)
Ro.*(phi(1)^2+phi(2).*phi(5)-phi(3)^2+1)-Co*(phi(3)-1.0)
phi(4)
Ro*(2.0*phi(1)*phi(3) + phi(4)*phi(5))+Co*phi(1)
-2.0*phi(1)];
end
Error:
Trial>> Pphiode(20,2,-1,1,1)
Index exceeds matrix dimensions.
Error in Pphiode (line 3)
dphidz = [phi(2)
Let say
z=12, phi=1, R0=-1, Eta=0, Lambda=1

채택된 답변

KSSV
KSSV 2017년 9월 27일
The input
phi = 1 ;
should be a vector with elements 5. Try with:
phi = rand(5,1) ;
  댓글 수: 2
nanana sehaa
nanana sehaa 2017년 9월 27일
Thank you so much!
nanana sehaa
nanana sehaa 2017년 9월 27일
And how about this? Should i enter rand(5,1) for both phi0 and phiinf?
function bc = Pphibc (phi0,phiinf,Ro,Eta,Lambda)
bc = [phi0(1)-Lambda*phi0(2)
phi0(3)-Eta*phi0(4)
phi0(5)
phiinf(1)
phiinf(3)+1];
end

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by