Solving System ODE with ode45

조회 수: 3 (최근 30일)
Donrad
Donrad 2016년 11월 30일
댓글: Donrad 2016년 11월 30일
Hi All, I'm trying to solve a system ODE with ode45. I get this error for my code:
Error in ode45 (line 115) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Any help is appreciated. I have attached the m.files
  댓글 수: 2
bio lim
bio lim 2016년 11월 30일
I don't see your .m files.
Donrad
Donrad 2016년 11월 30일
Whoops. Files are now attached, thanks for the heads up.

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

채택된 답변

bio lim
bio lim 2016년 11월 30일
편집: bio lim 2016년 11월 30일
With first look, in your function, there are many undefined variables, that are X0, y0, z0, and Ap0.
  댓글 수: 10
bio lim
bio lim 2016년 11월 30일
I see. Defining unnecessary variables is the first thing you should avoid.
You have defined:
Tg=1;
Tr=2;
ProInh2=3;
HGlnInh=4;
Inh=5;
TrTg=6;
p2_Tr=7;
and then:
x0(Tg)=1;
x0(Tr)=1;
x0(ProInh2)=0;
x0(HGlnInh)=1;
x0(Inh)=0;
x0(TrTg)=1;
x0(p2_Tr)=0;
These are simple things you should avoid. Just set x0(1) = 1, or even better x0 = [1 . . . ], and make a comment saying the first element of your initial condition is Tg. Declaring many variables like this makes your program look very complicated and tiring to look at, especially for debugging. For example, when I was looking at your function definition, I had hard time following it due to the number of variables, and which index is being manipulated in your operations.
Donrad
Donrad 2016년 11월 30일
Yeah, I used the proper I.Cs:
x0(Tg)=0.167;
x0(Tr)=0.0002;
x0(ProInh2)=1.5;
x0(HGlnInh)=0;
x0(Inh)=.278;
x0(TrTg)=0;
x0(p2_Tr)=0;
But no solution so far. I agree I have to code efficiently.

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

추가 답변 (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