- Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
- Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
- Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support so we can investigate.
solving a single differential equation by using ode45, but it can't solve should I write something else.
1 view (last 30 days)
Show older comments
clc
ti = 0; %inital time
tf = 10E-5;% final time
tspan=[ti tf];
tc = 70E-9; %photon life time in cavity
P = 1; %pump strenght
k = 0.035; %critical coupling strength
l= 0.5;
s = 0.1;
f = @(t,y) [
- ((((s)^2).*k).*sin(y(1)-pi/2))./tc
];
%initial consitions
[T,Y] = ode45(f,tspan,[1]);
%plotting the graphs
plot(T,Y);
1 Comment
Steven Lord
on 19 Jul 2022
What does "can't solve" mean in this context?
Accepted Answer
Sam Chak
on 19 Jul 2022
@SAHIL SAHOO, based on the ODE in this image
the output probably becomes like this:
ti = 0; % inital time
tf = 10E-5; % final time
tspan = [ti tf];
% P = 1; % pump strength (not used)
kappa = 0.035; % critical coupling strength
L = 0.5;
sigma = 0.1;
tauc = 70E-9; % photon life time in cavity
% differential equation
f = @(t,y) [- ((sigma^2)*kappa/tauc)*sin(y - pi/2) + L*(sigma^2)/(2*tauc)*sin(y + pi/2)/sqrt(1 + cos(y + pi/2))];
[T, Y] = ode45(f, tspan, 1);
plot(T, Y); grid on, xlabel('t'), ylabel({'$\varphi_{0}(t)$'}, 'Interpreter', 'latex')
0 Comments
More Answers (0)
See Also
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!