"Inputs must be floats, namely single or double"

조회 수: 1 (최근 30일)
Noob
Noob 2017년 6월 13일
편집: Noob 2017년 6월 19일
system of equations is:
F = @(t, r, y) [y(1), y(2), y(3), f_integral]
And then calling the ode solver:
[t, y] = ode45(F, [0 5], [1 1 1]).
  댓글 수: 1
Torsten
Torsten 2017년 6월 13일
Please show the differential equation you are trying to solve in a mathematical notation.
From the question you deleted meanwhile, it was not clear what you were trying to solve (at least for me).
Best wishes
Torsten.

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

채택된 답변

Torsten
Torsten 2017년 6월 13일
function main
tspan=[0 5];
y0=[1; 1; 1; 0];
[t,y]=ode45(@fun,tspan,y0)
function dy=fun(t,y)
dy=zeros(4,1);
dy(1)=y(1);
dy(2)=y(2);
dy(3)=y(3);
funint=@(r)(y(3)^2+y(4)^2)*r;
dy(4)=integral(funint,-1,1);
Best wishes
Torsten.
  댓글 수: 1
Torsten
Torsten 2017년 6월 13일
r is just a formal integration variable - it's not needed in the parameter list for "fun".
Best wishes
Torsten.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by