Filter löschen
Filter löschen

how to solve integral in the defining the function command?

1 Ansicht (letzte 30 Tage)
SAHIL SAHOO
SAHIL SAHOO am 19 Jul. 2022
Bearbeitet: Torsten am 20 Jul. 2022
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 ?

Antworten (1)

Torsten
Torsten am 19 Jul. 2022
Bearbeitet: Torsten am 19 Jul. 2022
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 Kommentare
SAHIL SAHOO
SAHIL SAHOO am 20 Jul. 2022
but how ill you write this in this?
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));
];
if you integrate outside it will give different result.
Torsten
Torsten am 20 Jul. 2022
Bearbeitet: Torsten am 20 Jul. 2022
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Chemistry finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by