How to solve complex equations?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Navaneeth
el 13 de Feb. de 2024
Comentada: Navaneeth
el 14 de Feb. de 2024
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 comentarios
Respuesta aceptada
Torsten
el 13 de Feb. de 2024
Editada: Torsten
el 13 de Feb. de 2024
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)
vpa(S1.theta)
S1.parameters
S1.conditions
5 comentarios
Torsten
el 14 de Feb. de 2024
Editada: Torsten
el 14 de Feb. de 2024
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))
format long
S1 = double(S1(abs(imag(S1))<1e-6))
Más respuestas (0)
Ver también
Categorías
Más información sobre Special Values en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!