run the program in matlab

1 次查看(过去 30 天)
shiv gaur
shiv gaur 2022-1-25
评论: shiv gaur 2022-1-25
% n1=1.512;
% n2=1.521;
% n3=4.1-1i*0.211;
%
% n4=1;
% lambda = 633;
% k0 = (2*pi)/lambda;
% t2 = 50;
% t3=0;
T3=1e-9:1e-9:1e-6;
for i=1:numel(T3)
t3=T3(i);
[b]=fminsearch(@(b) abs(trial0(complex(b(1),b(2)))) ,[1,1]);
beta=complex(b(1),b(2))
end
plot(T3,real(beta))
function beta1 = trial0(beta,t3)
n1=1.512;
n2=1.521;
n3=4.1-1i*0.211;
n4=1;
lambda = 633e-9;
k0 = (2*pi)/lambda;
t2 = 2e-6;
%t3=0;
m=0;
S1 = k0*sqrt(n1^2-beta^2);
S2 = k0*sqrt(n2^2-beta^2);
S3 = k0*sqrt(n3^2-beta^2);
S4 = k0*sqrt(n4^2-beta^2);
beta1=-(S2)*t2+atan(S1/1i*S2)+atan((S3/S2).*tan(atan(S4/1i*S2)-S3*t3))+m*pi;
end
how to plot this equation value is getttng the no plot

回答(1 个)

Walter Roberson
Walter Roberson 2022-1-25
T3=1e-9:1e-9:1e-6;
for i=1:numel(T3)
t3=T3(i);
[b]=fminsearch(@(b) abs(trial0(complex(b(1),b(2)), t3)) ,[1,1]);
beta(i)=complex(b(1),b(2));
end
plot(T3,real(beta))
function beta1 = trial0(beta,t3)
n1=1.512;
n2=1.521;
n3=4.1-1i*0.211;
n4=1;
lambda = 633e-9;
k0 = (2*pi)/lambda;
t2 = 2e-6;
%t3=0;
m=0;
S1 = k0*sqrt(n1^2-beta^2);
S2 = k0*sqrt(n2^2-beta^2);
S3 = k0*sqrt(n3^2-beta^2);
S4 = k0*sqrt(n4^2-beta^2);
beta1=-(S2)*t2+atan(S1/1i*S2)+atan((S3/S2).*tan(atan(S4/1i*S2)-S3*t3))+m*pi;
end
  3 个评论
Walter Roberson
Walter Roberson 2022-1-25
I do not encounter the problem.
T3=1e-9:1e-9:1e-6;
for i=1:numel(T3)
t3=T3(i);
[b]=fminsearch(@(b) abs(trial0(complex(b(1),b(2)), t3)) ,[1,1]);
beta(i)=complex(b(1),b(2));
end
figure
plot(T3,real(beta)); title('real')
figure
plot(T3, imag(beta)*1e5); title('imag')
function beta1 = trial0(beta,t3)
n1=1.512;
n2=1.521;
n3=4.1-1i*0.211;
n4=1;
lambda = 633e-9;
k0 = (2*pi)/lambda;
t2 = 2e-6;
%t3=0;
m=0;
S1 = k0*sqrt(n1^2-beta^2);
S2 = k0*sqrt(n2^2-beta^2);
S3 = k0*sqrt(n3^2-beta^2);
S4 = k0*sqrt(n4^2-beta^2);
beta1=-(S2)*t2+atan(S1/1i*S2)+atan((S3/S2).*tan(atan(S4/1i*S2)-S3*t3))+m*pi;
end
shiv gaur
shiv gaur 2022-1-25
this fig is not visible if we want to plot 1e-9 to 1e-7 vs abs( imag(beta)*1e5)
pl help

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by