Mj = [cos (kj hj) i*sin(kj hj) /kj ; i*kj*sin(kj hj) cos (kj hj) ];
kj=sqrt(nj^2*k02-x^2);
Take
n1=1.521;n2=2.66;k0=1;h1=1.5e-6;h2=1e-6
multiply M1*M2

댓글 수: 4

Image Analyst
Image Analyst 2021년 9월 26일
And the question is. . . . 🤔
Steven Lord
Steven Lord 2021년 9월 26일
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
shiv gaur
shiv gaur 2021년 9월 26일
편집: Walter Roberson 2021년 9월 27일
%this is program
function kp1
close all;
clear all;
function y=F(x)
for t2=1
k0=1;
n1=1.521;
%n2=2.66;
n2=4.1-0.211*1i;
ns=1.512;
%nc=0.15-1i*3.2;
nc=1;
k1=sqrt(n1.^2*k0.^2-x.^2);
k2=sqrt(n2.^2*k0.^2-x.^2);
t1=1.5;
m11= cos(t1*k1)*cos(t2*k2)-(k2/k1)*sin(t1*k1)*sin(t2*k2);
m12=(1/k2)*(cos(t1*k1)*sin(t2*k2)*1i) +(1/k1)*(cos(t2*k2)*sin(t1*k1)*1i);
m21= (k1)*cos(t2*k2)*sin(t1*k1)*1i +(k2)*cos(t1*k1)*sin(t2*k2)*1i;
m22=cos(t1*k1)*cos(t2*k2)-(k1/k2)*sin(t1*k1)*sin(t2*k2);
A=[m11 m12 ; m21 m22];
disp(eig(A))
gs=x.^2-ns.^2*k0.^2;
gc= x.^2-nc.^2*k0.^2;
y= 1i*(gs*m11+gc*m22)-m21+gc*gs*m12 ;
%y=x^2+x+1;
end
end
p0=1;
p1=1.5;
p2=2;
tol = 10^-5;
n = 50;
h1 = p1 - p0;
h2 = p2 - p1;
del1 = (F(p1)-F(p0))./h1;
del2 = (F(p2)-F(p1))./h2;
d = (del2-del1)./(h2+h1);
I = 3;
%Step 2
while I <= n
%Step 3
b = del2+h2.*d;
D = sqrt(b.^2-4.*F(p2).*d); % could be complex
%Step 4
if abs(b - D) < abs(b + D)
E = b + D;
else
E = b - D;
end
%Step 5
h = -2.*F(p2)./E;
p = p2 + h;
if I == 3
table{1} = 'Muller''s Method Iterations';
table{2}=' I P f(P) ';
table{3}='-----------------------------------------------------';
end
str = sprintf('%3u: % 6.6f + %6.6fi % 6.6f + %6.6fi',I,real(p),imag(p),real(F(p)),imag(F(p)));
table{I + 1} = str; %#ok<*AGROW>
%Step 6
if abs(h) < tol
val = p;
table = char(table);
break
end
p0 = p1;
p1 = p2;
p2 = p;
h1 = p1 - p0;
h2 = p2 - p1;
del1 = (F(p1)-F(p0))./h1;
del2 = (F(p2)-F(p1))./h2;
d = (del2-del1)./(h2+h1);
I = I + 1;
end
disp(p)
end
Jan
Jan 2021년 9월 26일
Please format your code properly. Use the icons on top of the field for editing in the forum.
You still did not ask a question.

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

답변 (1개)

Walter Roberson
Walter Roberson 2021년 9월 27일

0 개 추천

syms x
n = [1.521, 2.66];
k0 = 1;
h = [1.5e-6, 1e-6];
k = @(j) sqrt(n(j).^2*k0.^2-x.^2);
M = @(j) [
cos(k(j) .* h(j)), i*sin(k(j) .* h(j))/k(j)
i .* k(j) .* sin(k(j).*h(j)), cos(k(j) .* h(j))
]
M = function_handle with value:
@(j)[cos(k(j).*h(j)),i*sin(k(j).*h(j))/k(j);i.*k(j).*sin(k(j).*h(j)),cos(k(j).*h(j))]
M12 = M(1) * M(2)
M12 = 

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2021a

태그

질문:

2021년 9월 26일

답변:

2021년 9월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by