k0=2*pi/632.8e-9;
n1=1.512;
n2=1.521;
n3=2.66;
n4=0.15+1i*3.5;
t2=2e-6;
m=0;
t3=1e-9:1e-6;
k1=@(x) k0*sqrt(n1^2-x^2);
k2=@(x) k0*sqrt(n2^2-x^2);
k3=@(x) k0*sqrt(n3^2-x^2);
k4=@(x) k0*sqrt(n4^2-x^2);
y=@(x,t3)-(k2)*t2+atan(k1/1i*k2)+atan((k3/k2)*tan(atan(k4/1i*k2)-k3*t3))+m*pi;
plot(t3,real(x))
plot(t3,imag(x)

댓글 수: 8

KSSV
KSSV 2022년 1월 25일
편집: KSSV 2022년 1월 25일
@shiv gaur You are continuously asking the same kind of questions, without completing/ commenting/ closing/ acknowledging the previous questions. Please don't do that. If the questions are same, discuss at the same question.
In the above code, t2 is not defined. x is not defined. What exactly you are trying to achieve? Ask a question so that people can understand to help you.
The above question, is simple. You have used anonymous function. Substitute x in k1, k2, k3, k4 and then use those values in the formula y with t's defined. Then use plot.
shiv gaur
shiv gaur 2022년 1월 25일
this is function of x and t3 first we have to find root of equation then plot
if question is simple pl solve the problem
KSSV
KSSV 2022년 1월 25일
If question is simple, that doesn't mean that we will do your work. You have to give some attempt and if you stuck you are welcome to ask a question.
shiv gaur
shiv gaur 2022년 1월 25일
it is not so simple question
KSSV
KSSV 2022년 1월 25일
If you want to find the root...use syms. Read about solve and syms.
shiv gaur
shiv gaur 2022년 1월 25일
this is the program pl plot t3=1e-9 to 1e-6 vs real x
program is running
[b]=fminsearch(@(b) abs(trial0(complex(b(1),b(2)))) ,[1,1]);
beta=complex(b(1),b(2))
function beta1 = trial0(beta)
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 pl help to write where we store the value of t3 plot
shiv gaur
shiv gaur 2022년 1월 25일
i try but empty value showing

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

답변 (0개)

카테고리

제품

릴리스

R2021b

태그

질문:

2022년 1월 25일

댓글:

2022년 1월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by