- 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 次查看(过去 30 天)
显示 更早的评论
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 个评论
Steven Lord
2022-7-19
What does "can't solve" mean in this context?
采纳的回答
Sam Chak
2022-7-19
@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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!