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일
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

Thank you for your answer but I still didn't understand the concept.Please explain if possible.
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.
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 ♥
They should be in one place
Thank you for accepting answer!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

질문:

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