Errors when using ODE 45, Phase portraits
Show older comments
Hello! Please help me in creating a phase portrait for the system of differential equations. I`ve received such errors:
1) Error using PE>peFun Too many input arguments.
2)Error in odearguments (line 90) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
3)Error in ode45 (line 115) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
4) Error in PE (line 15) [tSol,ALPHASol]=ode45(@peFun,tspan,vPUR,vER,ALPHA0); %function calling before function definition
Sorry I make a mistake in previous code, but still receive errors:
tspan=[0 1];
aplha=[0 pi];
beta=[0 pi];
% To run P-E system
%%Initialization
eta0=pi/4;
r0=sqrt(2);
beta0=0;
alpha0=pi/4;
xP0=0;
yP0=0;
xE0=1;
yE0=1;
ALPHA0=[eta0;r0;beta0;alpha0;xP0;yP0;xE0;yE0];
[tSol,ALPHASol]=ode45(@peFun,tspan,ALPHA0);
%function calling before function definition
plot(tSol,ALPHASol);
function fval=peFun(t,ALPHA)
% Get variables
eta=ALPHA(1);
r=ALPHA(2);
beta=ALPHA(3);
alpha=ALPHA(4);
xP=ALPHA(5);
yP=ALPHA(6);
xE=ALPHA(7);
yE=ALPHA(8);
% Constants
a=1;
% Describing dALPHA/dt
for alpha=[0 pi];
beta=[0 pi];
fval=zeros(8,1);
fval(1,1)=(-vPUR*sin(beta)+vER*sin(alpha))/r;
fval(2,1)=vER*cos(alpha)-vPUR*cos(beta);
fval(3,1)=(a/r)*(vER*sin(alpha)-vPUR*sin(beta));
fval(4,1)=(-vER*sin(alpha)+vER*sin(beta))/r;
fval(5,1)=vPUR*cos(eta+beta);
fval(6,1)=vPUR*sin(eta+beta);
fval(7,1)=vER*cos(eta+alpha);
fval(8,1)=vER*sin(eta+alpha);
end;
end
Thank you a lot!
Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!