run the program in matlab

조회 수: 13 (최근 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에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by