Could anyone help me with this warning please?

This is my code :
function RunLogOscilNumeric3
k =10;
p0 =0.1;
t =(0:0.01:10000);
omega = 1;
N0 = 1;
[t,p]=ode23(@logOscilnumeric3,t,p0,[],omega,k,N0);
Pmax = max(p)
Pmean = mean(p)
figure(1)
plot(t,p)
title('The plot of the system with time')
xlabel ('Time')
ylabel ('The system' )
1;
% function dpdt = logOscilnumeric3(t,p,omega,k,N0)
% dpdt = N0*p - (N0*sin(omega*t)*p.^2/k);
% end
Notes: 1- Warning: Failure at t=5.060889e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.421085e-14) at time t.
2- I tried to change the ode solver ,,but I still got this warning.
3- I want to solve this system for the specific values of the parameters and time'' I do not want to change those at all'' ,, because I am trying to solve different systems for the same parameters and time vector.
What should I do please?
Thanks in advance.

 Accepted Answer

The analytical solution for your ODE is given by
p(t)=20*exp(t)/(exp(t)*(cos(t)-sin(t))-201)
This function has a singularity between t=5 and t=5.5.
Best wishes
Torsten.

7 Comments

Many thanks. OMG singularity again,,it is like a bad dream for me!!! Do you have any suggestion please?
Dear Torsten
When I solved the above system by details, I got this result which is different from yours,, Could you check it again please??
My result is : p(t)=20*exp(t)/(exp(t)*(sin(t)-cos(t))+1)
The initial condition is not satisfied for your solution: p(0)=0.1.
Best wishes
Torsten.
So what is the initial condition that you used to find the above result please?
Sorry, I overlooked a minus sign:
p(t)=-20*exp(t)/(exp(t)*(cos(t)-sin(t))-201)
is the solution of the ODE
p'(t) - (p(t)-Sin[t]*p(t)^2/10) = 0, p(0)=0.1
Best wishes
Torsten.
Dear Torsten If I have the following system : dx/dt = N0*sin(omega*t)*x - (N0*x.^2 / k)
I tried to solve it analytically but I am getting this formula which I can not continue:
( exp( (-N0/omega)*(cos(omega*t)) )/x)= ( integral( (N0/omega) * (exp( (-N0/omega) * (cos(omega*t)) )) )dt )
can you help me please?
Regards
Try MATLAB's dsolve.
If an explicit solution can not be found, you will have to solve the equation numerically for given values of N0, omega and k.
Best wishes
Torsten.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!