필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

previous technique didnt work

조회 수: 1 (최근 30일)
MINATI
MINATI 2019년 2월 24일
댓글: MINATI 2019년 2월 24일
function main
clc;clear all;
so=1;
c=-1.25;
% a=1;
Pr=1;
n=2;
x=5;
x1=fsolve(@solver,x);
function F=solver(x)
[t,u]=ode45(@equation,[0,20],[so c 1 x]);
s=length(t);
F=[u(s,2)-1; u(s,4)];
function dy=equation(t,y)
dy=zeros(5,1);
dy(1)=y(2);
dy(2)=y(3);
dy(3)=y(2)^2-y(1)*y(3)-1;
dy(4)=y(5);
dy(5)=Pr*(n*y(2)*y(4)-y(1)*y(5));
end
end
function dy=equation(t,y)
dy=zeros(5,1);
dy(1)=y(2);
dy(2)=y(3);
dy(3)=y(2)^2-y(1)*y(3)-1;
dy(4)=y(5);
dy(5)=Pr*(n*y(2)*y(4)-y(1)*y(5));
end
[t,u]=ode45(@equation,[0,20],[so c 1 x1]);
figure(1)
plot(t,u(:,4),'b-');
hold on
end
ERROR is:
Index exceeds matrix dimensions.
Error in solver/equation (line 22)
dy(4)=y(5);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in (line 14)
[t,u]=ode45(@equation,[0,20],[so c 1 x]);
Error in fsolve (line 230)
fuser = feval(funfcn{3},x,varargin{:});
Error in (line 12)
x1=fsolve(@solver,x);
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
>>
  댓글 수: 1
MINATI
MINATI 2019년 2월 24일
ERROR is included below the code

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by