필터 지우기
필터 지우기

How to use ode45 to solve a system with many dimensions?

조회 수: 1 (최근 30일)
Choszit Lee
Choszit Lee 2017년 6월 9일
댓글: Walter Roberson 2017년 6월 10일
Hi there,
I meet a interesting question——How to simulate a system with 100 dimensions using ode45?
Obviously, it's impossible to write all equations as below:
dx(1)=x(1)*(α(1)-a(1,1)*x(1)-a(1,2)*x(2)...)
dx(2)=x(2)*(α(2)-a(2,1)*x(1)-a(2,2)*x(2)...)
...
dx(100)=x(100)*(α(100)-a(100,1)*x(1)-a(100,2)*x(2)...)
Does there exist any tricks to solve this questions?
Looking forward to any suggestions~

채택된 답변

James Tursa
James Tursa 2017년 6월 9일
If I understand your equations correctly, simply
dx = x .* (alpha - a*x);
  댓글 수: 2
Choszit Lee
Choszit Lee 2017년 6월 10일
Thank you for your answer~Yesterday I have tried to generate a function as below:
function dxdt = MyFunc(t,x)
global a alpha
dxdt = x.*(alpha-a*x);
end
Then run ode45(MyFunc, [0 100], [2 1]) in my main function, I gain a error: Not enough input arguments. However, when I use dxdt=@(t,x)[x.*(alpha-a*x)] instead, it works well...This really puzzles me.
Walter Roberson
Walter Roberson 2017년 6월 10일
An error like that can be caused by using
ode45(MyFunc, .....)
instead of
ode45(@MyFunc, .....)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 常微分方程에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!