fsolve stopped because the problem appears regular
3 次查看(过去 30 天)
显示 更早的评论
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
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/279803/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/279804/image.png)
6 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!