use of arrays in variable

2 views (last 30 days)
shiv gaur
shiv gaur on 7 Jan 2022
Commented: shiv gaur on 7 Jan 2022
function y=f(kx)
l=6330*(10)^(-10);
k0=2*pi/l;
nc=1.33;
ec=nc^2;
na=1.43;
ea=na^2;
nf=1.59;
ef=nf^2;
nm=0.064+1i*4;
em=nm^2;
ns=1.495;
es=ns^2;
df=0.5e-6;
dm=0.03e-6;
%da=0.06e-6;
%kx=(2*pi/l)*np*sin(a);
kc=k0*sqrt(x^2-ec);
ka=k0*sqrt(ea-x^2);
kf=k0*sqrt(ef-x^2);
km=k0*sqrt(em-x^2);
ks=k0*sqrt(x^2-es);
rfm=(kf-km)/(kf+km);
rms=(km-ks)/(ks+km);
rfa=(kf-ka)/(kf+ka);
rac=(ka-kc)/(ka+kc);
a=(1-rfm)/(1+rfm);
b=(1-rms*exp(2*1i*dm*km))/(1+rms*exp(2*1i*dm*km));
c=(1-rfa)/(1+rfa);
f=(1-rac*exp(2*1i*da*ka))/(1+rac*exp(2*1i*da*ka));
pfms=2*atan(1i*a*b);
pfac=2*atan(1i*c*f);
y=2*kf*df-pfms-pfac;
end
this is the simple function program we have to calculate the value of df/ddna ie chane in f/change in na vs da
how to use this program
  3 Comments
shiv gaur
shiv gaur on 7 Jan 2022
modified program
function y=f(x)
l=6330*(10)^(-10);
k0=2*pi/l;
nc=1.33;
ec=nc^2;
na=1.43;
ea=na^2;
nf=1.59;
ef=nf^2;
nm=0.064+1i*4;
em=nm^2;
ns=1.495;
es=ns^2;
df=0.5e-6;
dm=0.03e-6;
%da=0.06e-6;
%kx=(2*pi/l)*np*sin(a);
kc=k0*sqrt(x^2-ec);
ka=k0*sqrt(ea-x^2);
kf=k0*sqrt(ef-x^2);
km=k0*sqrt(em-x^2);
ks=k0*sqrt(x^2-es);
rfm=(kf-km)/(kf+km);
rms=(km-ks)/(ks+km);
rfa=(kf-ka)/(kf+ka);
rac=(ka-kc)/(ka+kc);
a=(1-rfm)/(1+rfm);
b=(1-rms*exp(2*1i*dm*km))/(1+rms*exp(2*1i*dm*km));
c=(1-rfa)/(1+rfa);
f=(1-rac*exp(2*1i*da*ka))/(1+rac*exp(2*1i*da*ka));
pfms=2*atan(1i*a*b);
pfac=2*atan(1i*c*f);
y=2*kf*df-pfms-pfac;
end
shiv gaur
shiv gaur on 7 Jan 2022
pl solve this problem if any one not interested leave it others to solve the problem this is high class problem
by changing two variable df/dna ie change in x/change in na at different value of da
fig is attatch

Sign in to comment.

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!