I am trying to solve the following equation.
I have the following script to solve for theta, but getting erro when I am running the program.
Any suggestions is much appreciated.
Thank you.
clc;
clear;
close all;
syms theta
assume(0 <= theta <= 2*pi)
t = 0.4e-3;
n = 1.523;
delta_y = 3;
S1 = solve(delta_y == t*sind(theta)*(1 - sqrt((1-sind(theta)^2)/n^2 - sind(theta)^2)),theta);

3 件のコメント

John D'Errico
John D'Errico 2024 年 2 月 13 日
編集済み: John D'Errico 2024 年 2 月 13 日
You don't say what that equation should model. While the picture seems to show the variables, it shows what appears to be a rectangle canted at an angle. But one edge of the rectangle seems to have length t, and the other parallel edge shows that as n. So your drawing does not make sense. Perhaps n and t do not mean what they are shown as. I might guess that n refers to one dimension of the rect, and t is the other. But that is just a wild guess. But then one cannot possibly derive the equation, or show that it is correct.
Torsten
Torsten 2024 年 2 月 13 日
You forgot a bracket around the denominator under the square root.
Navaneeth
Navaneeth 2024 年 2 月 14 日
Sorry that I left out some details. N here is refractive index of the material and t is the thickness of the slab...I want to find the theta in angles for a fixed shift of delta_y.
Thank you.

サインインしてコメントする。

 採用された回答

Torsten
Torsten 2024 年 2 月 13 日
編集済み: Torsten 2024 年 2 月 13 日

1 投票

Your equation has only complex solutions.
Note that you used sind instead of sin in the function definition. Thus assuming theta in radians is wrong.
clc;
clear;
close all;
syms theta
%assume(0 <= theta <= 2*pi)
t = 0.4e-3;
n = 1.523;
delta_y = 3;
S1 = solve(delta_y == t*sind(theta)*(1 - sqrt((1-sind(theta)^2)/(n^2 - sind(theta)^2))),theta,'ReturnConditions',1,'MaxDegree',3)
S1 = struct with fields:
theta: [2×1 sym] parameters: k conditions: [2×1 sym]
vpa(S1.theta)
ans = 
S1.parameters
ans = 
k
S1.conditions
ans = 

5 件のコメント

Navaneeth
Navaneeth 2024 年 2 月 14 日
Thank you, excuse me for asking what are these parameters and condition and how can I get the theta value in simple degrees from this format.
Torsten
Torsten 2024 年 2 月 14 日
The solutions in "degrees" are
360*k + 270 - 56.305582...*1i
-360*k - 90 + 56.305582...*1i
where 1i is the imaginary unit and k is any integer.
As said, a real solution does not exist in the case of your parameters.
Navaneeth
Navaneeth 2024 年 2 月 14 日
Thank you, but solving for delta_y for a fixed theta value gives me a real value
clc;
clear;
close all;
syms delta_y_raw
t = 0.7e-3; %thickness
theta = 5; %angle
n = 1.533; %refractive index of the material.
d_y = solve(delta_y_raw == t*sind(theta)*(1 - sqrt((1-sind(theta)^2)/(n^2 - sind(theta)^2))), delta_y_raw);
delta_y = double(d_y)/1e-6 % in um
delta_y = 21.2991
Now to find theta for different delta_y how to use this equation in such a way that I dont get complex theta solutions.
Thank you.
Torsten
Torsten 2024 年 2 月 14 日
編集済み: Torsten 2024 年 2 月 14 日
If you use the new parameters, you get back some real solutions:
clc;
clear;
close all;
syms theta
t = 0.7e-3;
n = 1.533;
delta_y = 21.2991*1e-6;
S1 = vpa(solve(delta_y == t*sind(theta)*(1 - sqrt((1-sind(theta)^2)/(n^2 - sind(theta)^2))),theta,'MaxDegree',3))
S1 = 
format long
S1 = double(S1(abs(imag(S1))<1e-6))
S1 =
1.0e+02 * 1.749999973612585 - 0.000000000000000i 0.050000026387415 + 0.000000000000000i
Navaneeth
Navaneeth 2024 年 2 月 14 日
Thank you, this is exactly what I wanted.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2023a

質問済み:

2024 年 2 月 13 日

コメント済み:

2024 年 2 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by