I am getting Error using deval

11 views (last 30 days)
nune pratyusha
nune pratyusha on 26 Aug 2022
Edited: Torsten on 26 Aug 2022
function yd = hyperchaos(t,y) %%%% selecting some cases for publication
global aa bb dd aa =3.55;
dd = 0;
mm=1;
n1 =1-aa*(y(2))*y(3);
n2 =1*y(3)*abs(y(3))-(y(3));
n3 =1*(mm*(abs(y(1))-dd))-bb*y(3);
n4 = 0 ;
A=[ 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0];
B=[n1
n2
n3
n4];
yd=A*y+B;
clear
format long
global aa bb dd cc kk ee rr mm mm2 nn
dt=5*10^(-3);
tspan=(0:dt:500);
for i = 1:1:1
i
bb = -5+ (i-1)*0.025
dd = 0;
Y0=[0 5 0 0];
sol = ode45(@hyperchaos,[tspan(1) tspan(end)],Y0);
ss = deval(sol,tspan)';
s = ss(1500:end,:);
backColor = [0.5 0.5 0.5];
plot(s(1:end,1),s(1:end,2),'g'); xlabel('X');ylabel('Y')
drawnow
end
error:
>> main
i =
1
bb =
-5
Warning: Failure at t=2.738123e+00. Unable to meet integration tolerances without reducing the step size below
the smallest value allowed (7.105427e-15) at time t.
> In ode45 (line 351)
In main (line 23)
Error using deval (line 137)
Attempting to evaluate the solution outside the interval [0.000000e+00, 2.738123e+00] where it is defined.
Error in main (line 24)
ss = deval(sol,tspan)';
>>

Answers (1)

Torsten
Torsten on 26 Aug 2022
Edited: Torsten on 26 Aug 2022
Your integration could not be continued beyond t = 2.738123.
So you try to evaluate the solution in a region where you have no data available.

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!