fsolve stopped because the problem appears regular

Hi.
I want to find the value of w_s and N_s(s is subscript ) in the equations that are attached.
Please refer to the attachment.
I've written the code for it as follows
clc
clear all
c = 2.99792458e8; % velocity of light [cm/s]
Qt = 500; %total quality factor
Qi = 14300; %intrinsic quality factor
Qp = 10000; %crossport quality factor
lambda0 = 1554e-9; %free space wavelength
deltalambda = 0.01e-9; %step
lambda_start = 1540e-9; %start wavelength
lambda_end = 1560e-9; %end wavelength
lambda = lambda_start:deltalambda:lambda_end;
omega = 2*pi*c./lambda;
omega0 = omega(find(lambda==lambda0)); %omega0 equals 1.2121e15
gamai = omega0./2/Qi; %intrinsic loss rate
gamap = omega0./2/Qp; %cross port loss rate
gamat = omega0./2/Qt; %total loss rate
gamac = gamat-gamai-gamap; %cavity loss rate
gama1 = gamac./2;
gama2 = gama1;
rB = 0.2 ;
tB = sqrt(1-rB^2);
P=-1;
COS2 = 0.5*gama1./gama1.*tB^2/rB-0.5*tB^2/rB-rB;
SIN2 = P*tB./(2.*gama1*rB).*sqrt(4.*gama1.*gama1 - tB^2.*(gamac.^2));
conf = 0.5; %confinement factor
gN =5e-20; %differential gain
Ntr = 1e24; %transparency carrier density
alphai = 1000; %intrinsic factor
alpha=1; %henry factor
sigma = 3; %constant
L = 5e-6; %length
m = 25; %constant
%rR=rB+(2*gama1*exp(COS2+1i*SIN2))/(1i*(omega0-x(2))+gamat);
F=@(x)[
%rB+(2*gama1*exp(COS2+1i*SIN2))/(1i*(omega0-x(2))+gamat);
conf*gN*(x(1)-Ntr)-alphai-(1/(2*sigma*L))*log10(1/(abs(rB+(2*gama1*exp(COS2+1i*SIN2))/(1i*(omega0-x(2))+gamat)))^2);
imag(rB+(2*gama1*exp(COS2+1i*SIN2))/(1i*(omega0-x(2))+gamat))+((2*x(2))/c)*(-c*sigma*alpha*gN*(x(1)-Ntr)/(2*x(2))./c)*L-(2*m*pi)];
x0=[1 1];
x=fsolve(F,x0);
I don't get any output.
please guide me.

 採用された回答

darova
darova 2020 年 3 月 26 日

0 投票

Try this
[X,Y] = meshgrid((-6:0)*1e34, (-10:10)*1e34);
Z1 = X*0;
Z2 = X*0;
for i = 1:size(X,1)
for j = 1:size(X,2)
ZZ = F([ X(i,j) Y(i,j)] );
Z1(i,j) = ZZ(1);
Z2(i,j) = ZZ(2);
end
end
surf(X,Y,Z1,'facecolor','r')
hold on
surf(X,Y,Z2*1e13,'facecolor','b')
hold off
Doesn't look like solution exist

6 件のコメント

mohammad heydari
mohammad heydari 2020 年 3 月 26 日
Thank you for your answer but I still didn't understand the concept.Please explain if possible.
Walter Roberson
Walter Roberson 2020 年 3 月 26 日
darova is showing with a graph that the two equations are never simultaneously zero. There is a point or possibly line at which the two equations are equal, but it is not when the two are both 0.
darova
darova 2020 年 3 月 26 日
You have two functions, they depend on two variables
They can be represented as two surfaces (x,y variables they depend on)
You are solving equations and wants to find where surface can be zero
In this case two surfaces have zero values BUT in different places
Walter Roberson thanks bro ♥
darova
darova 2020 年 3 月 26 日
They should be in one place
mohammad heydari
mohammad heydari 2020 年 3 月 26 日
Thank you darova and Walter Roberson
darova
darova 2020 年 3 月 26 日
Thank you for accepting answer!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

タグ

質問済み:

2020 年 3 月 26 日

コメント済み:

2020 年 3 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by