How to find the solution of a system of equations with two known partial derivatives ?

2 views (last 30 days)
Hello everyone,
I'm trying to find the solution to a system of equations with two known partial derivatives. As I am in a study with very small displacements, I consider the net variations equal to the partial derivatives...
The code I use is not correct. The equations equ_8 and equ_9 are false because when compiled it gives 0==169/10000 and 0==29/10000. Furthermore, I think that forcing the study in alpha_0 by supervising alpha as I do in the "range" is really not the solution!
Can you help me please?
% * equ_1 to equ_7 represent a macanical system
% * I can only measure alpha (absolute) and l1 & L2 (relative) therefore the
% variations of l1 and l2
% * By measurement I know the variation of alpha compared to l1 at alpha_0
% and the variation of alpha compared to l2 at alpha_0
% * ==> I try to know the values of l1 and l2 at alpha_0
a1=150;
a2=150;
d=2910;
P=1;
alpha_0=0.0196;
syms alpha x y l1 l2 X1 X2 Y1 Y2
equ_1=l1^2==(x-a1*cos(alpha)+d)^2+(y-a1*sin(alpha))^2;
equ_2=l2^2==(x+a2*cos(alpha)-d)^2+(y+a2*sin(alpha))^2;
equ_3=X1+X2==0;
equ_4=Y1+Y2-P==0;
equ_5=a1*(X1*sin(alpha)-Y1*cos(alpha)) == a2*(X2*sin(alpha)-Y2*cos(alpha));
equ_6=Y1/X1==(y-a1*sin(alpha))/(x-a1*cos(alpha)+d);
equ_7=Y2/X2==(y+a2*sin(alpha))/(x+a2*cos(alpha)-d);
equ_8=diff(alpha,l1)==0.0169;
equ_9=diff(alpha,l2)==0.0029;
equations = [equ_1 equ_2 equ_3 equ_4 equ_5 equ_6 equ_7 equ_8 equ_9];
vars = [alpha x y l1 l2 X1 X2 Y1 Y2];
range = [alpha_0-0.1 alpha_0+0.1 ; -2900 2900 ; 0 -2400 ; 0 6000 ; 0 6000 ; -10 0 ; 0 10 ; 0 1 ; 0 1];
S=vpasolve(equations,vars,range);
l1_0 = S.l1;
l2_0 = S.l2;
  3 Comments
John D'Errico
John D'Errico on 23 Sep 2024
This is making little sense. alpha is apparently a (unknown) number. You define it as that, and use it as such. And you apparently want to solve for alpha as a number, not as a function.
But then you want to define alpha as a function of two other variables, that is, l1 and l2. You cannot differentiate it unless alpha is a function of those variables.
And you are clearly not trying to solve a differential equation, so this all makes little sense. You probably need to explain what you want to do better, more clearly.
Cédric
Cédric on 23 Sep 2024
Edited: Cédric on 26 Nov 2024
The first seven equations express the balance of my system. x and y are the coordinates of it's gravity center, alpha its inclination, Xi and Yi the forces according to x_axis and y_axis on it, l_i two distance from my system to two fixe points and finally P the weight.
With these seven equations, by fixing x and y to choose a desired position, if I solve the system (7 equations and 7 unknowns) I have alpha and the forces (which are experimentally correct)
In the new experience, I still know alpha by sensor mesurement. However, when the system is commissioned (moment zero), I do not know the distances l_i but I know alpha_0. I am trying to know these distances (l1_0 and l2_0) by measuring the variation of alpha when I vary the distances l_i separately (what I call delta_alpha/delta_l1 and delta_alpha/delta_l2)
I would therefore like to inject these two measurements into the system of equations (knowing that x and y are now unknown) to know l1 and l2.
I hope my question is better expressed (knowing that basically, I don't speak English!)

Sign in to comment.

Answers (1)

Arnav
Arnav on 25 Nov 2024
Since alpha is not a function of l1 and l2, it cannot be differentiated with respect to them. Equations 1 and 2 relate alpha, l1 and l2 in an implicit manner. From this, we can derive an implicit form of the partial derivatives using the chain rule as shown:
F1 = (x-a1*cos(alpha)+d)^2+(y-a1*sin(alpha))^2 - l1^2;
F2 = (x+a2*cos(alpha)-d)^2+(y+a2*sin(alpha))^2 - l2^2;
equ_8 = -diff(F1, l1) / diff(F1, alpha) == 0.0169;
equ_9 = -diff(F2, l2) / diff(F2, alpha) == 0.0029;
You may refer to the follow link for more information about symbolic differentiation: https://www.mathworks.com/help/symbolic/sym.diff.html
See if it helps you.
  1 Comment
Cédric
Cédric on 26 Nov 2024
Hi Arnav,
Thanks for your help, I'll reread the chain rules.
In this case, x and y are "functions" of α. In fact x, y, α, , and all change together. I try to numericaly find when, for an unknow equilibrium position, I only know α, and .

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!