- 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1070700/image.png)
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!