how to solve integral in the defining the function command?
1 次查看(过去 30 天)
显示 更早的评论
clc
%defining constant
ti = 0; %inital time
tf = 10E-5;% final time
tspan=[ti tf];
o = 10E6; % detuning frequency
tc = 70E-9; %photon life time in cavity
tf = 240E-6; %flouroscence lifetime
a = 0.02; %round trip loss
P = 1; %pump strenght
k = 0.2; %critical coupling strength
l= 0.5;
% define function
%y(1) = I
%y(2) = G
%y(3) = phase difference
f = @(t,y) [
((y(2)-a-l.*(abs(cos(y(3)+ pi/4)))).*y(1) + k.*y(1).*cos(y(3)- pi/2)).*(2/tc);
(P - (y(2).*(y(1) + 1))) / tf;
o - (k / tc).*2.* sin(y(3));
];
%initial consitions
[T,Y] = ode45(f,tspan,[1;1;1]*10E-5);
%plotting the graphs
plot(T,Y(:,3));
ylim([0 30])
in this the program I represent y(1) as I(Φ), in the equation 2 intead of y(1) i want to use integral of I(Φ)dΦ , where the we assume I(Φ) is gaussian distribution with a variable mean Φ0 and constant rms width σ = 0.1
is it possible to do this, if yes, how ?
0 个评论
回答(1 个)
Torsten
2022-7-19
编辑:Torsten
2022-7-19
integral_{0}^(t) I(phi) dphi = normcdf(t,0,0.1) - 0.5
So you can work with
y(1) = normcdf(t,0,0.1) - 0.5
in your equations.
2 个评论
Torsten
2022-7-20
编辑:Torsten
2022-7-20
I don't know the background of your equations.
If you want to take y1 as integral of I(Φ)dΦ , where we assume I(Φ) is gaussian distribution with a variable mean Φ0 and constant rms width σ = 0.1, the equations are
f = @(t,y) [ (P - (y(1).*(normcdf(t,0,0.1) - 0.5 + 1))) / tf; o - (k / tc).*2.* sin(y(2)) ];
Since the equation for y(1) is obsolete, y(2) became y(1) and y(3) became y(2) in the function handle.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!