필터 지우기
필터 지우기

Vector forcing a system of ODEs

조회 수: 4 (최근 30일)
Linford Briant
Linford Briant 2012년 10월 16일
Hi Mathworks,
I am using a time-dependent parameter in a system of ODEs - i.e. a vector is called at every timestep to force the system of differential equation. A good example of this being used is in the page for ode23, Example 3:
Now my system is quite stiff, and so I must use ode15s to solve it. Under no forcing (or time-independent/constant parameters) the folowing code is able to solve the system, and produces output as in the literature:
[t,x]=ode15s(@transmission,tspan,[0,0,0]);
When I introduce this vector 'forcing', I add the following code to the transmission.m file:
f = interp1(ft,f,t);
And add the following arguments to transmission.m (or to the first line of transmission.m):
function xprime = transmission(t,x,ft,f);
Now when I call this function, I must first load the time and value vectors for the forcing vector - ft and f. Suppose these have been loaded into the workspace, then the following code should solve the system of differential equations:
[t,x] = ode15s(@(t,x) transmission(t,x,ft,f),tspan,[0,0,0]);
Although it doesn't work - " Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN."
It works better in ode45, but the solution vector is just "NaN", i.e. it didn't work. Can someone help me get ode15s to work for this forced system please :)
Moreover, can someone explain what the argument
@(t,x) transmission(t,x,ft,f)
to ode15s means/is doing - I am used to the normal arguments for ode functions but I don't understand this one.
Thanks,
Linford

채택된 답변

Linford Briant
Linford Briant 2012년 10월 16일
편집: Linford Briant 2012년 10월 16일
To update you all... I am even more baffled, because the solver seems to correctly find solutions to the system if I set
ft=[0:0.01:5e4];
f=0.01*cos(0.002*ft);
This is a massive simplification of the forcing vector I would like to use, but I used it as a test to see if my ode code was correct... looks like it is, but the problem may lie with the vector I am trying to force the system with.
Perhaps my vector has a timestep that is too small (0.025ms), but it works for a cosine vector of the same timestep.
So I am thinking that it is the forcing function that is the problem and leading to the error:
Warning: Matrix is singular, close to singular or badly scaled.
Results may be inaccurate. RCOND = NaN.
But the system, when simulated in XPPAUT, is able to find a solution...
  댓글 수: 1
Linford Briant
Linford Briant 2012년 10월 16일
It would seem maybe that I need to adjust tspan accordingly (duh!!) but if anyone has anything to add to this, that would be great!

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

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