How to solve for 4 variables from 5 equations that I have derived.
4 次查看(过去 30 天)
显示 更早的评论
Hi, I have a problem in MATLAB. I am doing research in Optics ... I have to find 4 values from 5 equations and having some trouble. Kindly help.
I have tried reg this as below: I would be grateful to have any suggestions. Thanks in advance
clear
T = 0.89; R = 0.11; lamda = 0.98; d = 1.65; pi = 3.14; phit = 0.6; phir = 0.31; %((-(a))*d) == (23.03)*k;
% sym a b n k; % a and b are "alpha" and "beta"
a = sym('a'); b = sym('b'); n = sym('n'); k = sym('k');
eq1 = T == '({(1-R)^2+4*R*(sin(phir))^2}*exp((-a)*d))/((1-R*exp((-a)*d))^2+4*R*exp((-a)*d)*(sin(b+phir))^2)';
eq2 = (phit) == '((2*(pi)*n*d)/lamda)-(atan((k(n^2+k^2-1))/((k^2+n^2)*(2+n)*n)))+(atan((R*exp((-a)*d))*(sin2(b+phir))/(1-R*exp((-a)*d)*cos2(b+phir))))';
eq3 = (phir) == 'atan(((-2)*k)/(1-((n)^2)-((k)^2)))';
eq4 = (b) == '((2*(pi)*n*d)/lamda)';
eq5 = (a) == '((4*(pi)*k)/lamda)';
%eq6 = (e) == '((-(a))*d) == (23.03)*k';
[a b n k] = solve(eq1,eq2,eq3,eq4,eq5,a,b,n,k);
0 个评论
回答(4 个)
Azzi Abdelmalek
2012-10-2
编辑:Azzi Abdelmalek
2012-10-2
Corrected code
syms a b n k;
eq1 ='T==(((1-R)^2+4*R*(sin(phir))^2)*exp((-a)*d))/((1-R*exp((-a)*d))^2+4*R*exp((-a)*d)*(sin(b+phir))^2)';
eq2 = 'phit==((2*(pi)*n*d)/lamda)-(atan((k(n^2+k^2-1))/((k^2+n^2)*(2+n)*n)))+(atan((R*exp((-a)*d))*(sin2(b+phir))/(1-R*exp((-a)*d)*cos2(b+phir))))';
eq3 = 'phir==atan(((-2)*k)/(1-((n)^2)-((k)^2)))';
eq4 = 'b==((2*(pi)*n*d)/lamda)';
eq5 = 'a==((4*(pi)*k)/lamda)';
sol= solve(eq1,eq2,eq3,eq4,eq5,a,b,n,k)
but it seems that you system does'nt have solutions. Notice that you have more equations then unknown variables
0 个评论
Shaumik
2012-10-4
4 个评论
Walter Roberson
2012-10-4
编辑:Walter Roberson
2012-10-4
What are sin2() and cos2() ? If you want sin-squared you need sin(x)^2
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numbers and Precision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!