.what will be change in program if we varying h2 from 1e-3 to 1e-6 pl provide the solution.plot h2(x axis) vs x(real or x imaginary)

조회 수: 4 (최근 30일)
% Given values
n1 = 1.521;
n2 = 2.66;
k0 = 1;
h1 = 1.5e-6;
h2 = 1e-6;
ns = 1.512;
nc = 1.2 - 1i*7;
% Define symbolic variable for x
syms x
% Calculate k1 and k2
k1 = sqrt(n1^2 * k0^2 - x^2);
k2 = sqrt(n2^2 * k0^2 - x^2);
% Define M1 and M2 matrices
M1 = [cos(k1 * h1), 1i * sin(k1 * h1) / k1;
1i * k1 * sin(k1 * h1), cos(k1 * h1)];
M2 = [cos(k2 * h2), 1i * sin(k2 * h2) / k2;
1i * k2 * sin(k2 * h2), cos(k2 * h2)];
% Multiply matrices to get M
M = M1 * M2;
% Extract elements from M
m11 = M(1,1);
m12 = M(1,2);
m21 = M(2,1);
m22 = M(2,2);
% Define gs and gc
gs = x^2 - ns^2 * k0^2;
gc = x^2 - nc^2 * k0^2;
% Define the function f(x)
f = 1i * (gs * m11 + gc * m22) - m21 + gs * gc * m12;
% Use vpasolve for numerical solution
x_solution = vpasolve(f == 0, x);
% Display the solutions
disp('Numerical solutions for x:')
disp(x_solution)
  댓글 수: 3
shiv gaur
shiv gaur 2024년 12월 14일
the problem is reseach based exact fig is not mathching.If we vary the value of h2 from 1e-3 to 1e-6 then plot the graph
h2 vs x(real) or h2 vs x(imaginary) if any one have answer pl give response
Walter Roberson
Walter Roberson 2024년 12월 14일
What we are given is some particular code. Since we do not have any other information about the problem, the given code defines the problem. The solution to the given problem is that, by definition, the given code is perfect and does exactly what it is intended to do. Any error messages produced by the given code must have been intended.
If we had been given the equations or a link to the research paper, then it would have been different.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by