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 件のコメント
shiv gaur
shiv gaur 2022 年 1 月 25 日
help to 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 Center および File ExchangeAnnotations についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by