solve non linear equations symbolically
显示 更早的评论
I have 4 variables & 3 non linear equations. Objective is to get 4th non linear equations expressed in 2 variables.
Variables are
a b M phi
Equations are
x/sqrt(x^2+y^2) = -1 + 1/M * cos(phi)
y/sqrt(x^2+y^2) = 1/M * sin(phi)
arg(diff((x- jy)/sqrt(x^2+y^2)),a) = pi/2 - phi
where,
x = cos(a) - a*b*sin(a) - 1
y = a*b*cos(a) + sin(a)
Objective: Express variable 'b' in terms of 'M'
5 个评论
Walter Roberson
2016-12-1
Please check the below.
syms a b M phi x(a) y(a)
x(a) = cos(a) - a*b*sin(a) - 1;
y(a) = a*b*cos(a) + sin(a);
temp = diff((x(a)- j*y(a))/sqrt(x(a)^2+y(a)^2), a);
eqn = [x(a)/sqrt(x(a)^2+y(a)^2) == -1 + 1/M * cos(phi), y(a)/sqrt(x(a)^2+y(a)^2) == 1/M * sin(phi), angle(temp) == pi/2 - phi];
Your notation was ambiguous about whether you meant to take the derivative with respect to a, and take the two-quadrant arg() of that, compared to whether you meant to take the derivative without specifying the variable to take the derivative with respect to, and then to take the four-quadrant arg() with a being the second component.
If you meant to take the four-quadrant arg() then please confirm which of the two expressions is intended to be the "x" and which is intended to be the "y"; the MuPAD order https://www.mathworks.com/help/symbolic/mupad_ref/arg.html is the reverse of the MATLAB order https://www.mathworks.com/help/matlab/ref/atan2.html
Please also confirm whether your x and y are functions of only a, or if they are functions of a and phi
Dhiraj R
2016-12-1
Walter Roberson
2016-12-1
Fortunately the above happens to already fit that intention.
You can
solve(eqn,a,b,phi)
as you have three equations in four unknowns this would force a, b, and phi to be expressed in terms of M. Unfortunately it will report that no explicit solution can be found.
Walter Roberson
2016-12-1
Can we constrain a, b, phi, M to real-valued? If though you use imaginary components in the expression?
Dhiraj R
2016-12-2
采纳的回答
更多回答(1 个)
Juan Ponce
2017-8-25
编辑:Walter Roberson
2017-8-25
Hi Dhiraj R,
I obtain the following solutions, only with b and phi as variables.
% Variables Modelo
syms a b phi real
% a:Variable asociada a w*l ()
% b:Variable asociada a n2/l ()
% phi:Posicion angular (rad)
% n2:Constante de tiempo del filtro (s)
% Parametros Simbolicos
syms M real
% M:Sensitividad maxima Ms ()
% Ecuaciones auxiliares
x=cos(a)-a*b*sin(a)-1;
y=a*b*cos(a)+sin(a);
L=(x-j*y)/(x^2+y^2)^(1/2);
% Calculo Derivada Parcial
dL=diff(L,a);
% Calculo Argumento o Angulo
arg=atan(dL);
% Construccion Ecuaciones
% Nodos o Mallas, Fuerzas, Torques, Conservacion Energias
eq1=x/(x^2+y^2)^(1/2)-(-1+1/M*cos(phi)); % x/(x^2+y^2)^(1/2)=-1+1/M*cos(phi)
eq2=y/(x^2+y^2)^(1/2)-(1/M*sin(phi)); %y/(x^2+y^2)^(1/2)=1/M*sin(phi)
eq3=arg-(pi/2-phi); %arg=pi/2-phi
%%%%%%%%%%%%%%%%
F =
1 - (a*b*sin(a) - cos(a) + 1)/((sin(a) + a*b*cos(a))^2 + (a*b*sin(a) - cos(a) + 1)^2)^(1/2) - cos(phi)/M
(sin(a) + a*b*cos(a))/((sin(a) + a*b*cos(a))^2 + (a*b*sin(a) - cos(a) + 1)^2)^(1/2) - sin(phi)/M
phi - pi/2 - atan((sin(a) + i*cos(a) + b*sin(a) + a*b*cos(a) + b*i*cos(a) - a*b*i*sin(a))/((sin(a) + a*b*cos(a))^2 + (a*b*sin(a) - cos(a) + 1)^2)^(1/2) - ((2*(sin(a) + a*b*cos(a))*(cos(a) + b*cos(a) - a*b*sin(a)) + 2*(a*b*sin(a) - cos(a) + 1)*(sin(a) + b*sin(a) + a*b*cos(a)))*(i*sin(a) - cos(a) + a*b*sin(a) + a*b*i*cos(a) + 1))/(2*((sin(a) + a*b*cos(a))^2 + (a*b*sin(a) - cos(a) + 1)^2)^(3/2)))
X =
b
phi
mxd_nuevo =
[ -(2*sin(a - 4*pi*k) + 2*sin(a + 4*pi*k) + 4*sin(a) + 8*cos(2*pi*k)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) - 4*cos(2*pi*k - a)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) + 2*cos(2*pi*k - 2*a)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) - 2*cos(2*a - 2*pi*k)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) + cos(a)*(8*M*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) + 8*M^2*sin(a)) - 4*cos(a + 2*pi*k)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) - 8*M*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) - 8*M*sin(a - 2*pi*k) - 8*M*sin(a + 2*pi*k))/(a*cos(4*pi*k - 2*a) - a*cos(2*a - 4*pi*k) + 8*a*cos(2*pi*k)^2 - 16*M*a*cos(2*pi*k) + 8*M^2*a*cos(a)^2 - 4*M*a*cos(2*pi*k - 2*a) + 4*M*a*cos(2*a - 2*pi*k)), pi - acos(M*(sin(a) - 1))]
[ (sin(a - 4*pi*k) + sin(a + 4*pi*k) - sin(2*pi*k)*(4*(2*sin(a/2)^2 - 1)*(M^2 - sin(2*k*pi)^2)^(1/2) + 4*(M^2 - sin(2*k*pi)^2)^(1/2)) - sin(a)*(4*M^2*(2*sin(a/2)^2 - 1) + 2))/(4*a*(sin(a)^2 - 1)*M^2 + 4*a + 4*a*(sin(2*pi*k)^2 - 1)), pi - acos(M*(sin(a) - 1))]
Note: Each row of mxd_nuevo representa a solution bi,phi (i=1,2)
I dont know if this is right.
Good luck!!
Juan Ponce
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Solvers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!