How can I identify the most important independent variable in an equation?

5 次查看(过去 30 天)
Help! I have this equation. I would like to know the contribution of each independent variables to the dependent variable (for identifying the most important independent variable). Is this possible in MATLAB?
I tried doing this by taking the partial derivative of the equation with respect to each independent variable, but I am not sure how to identify which independent variable is most important/dominant.
syms x y z
f=sqrt(((x+y+y*z)-sqrt((x+y+y*z)^2-4*x*y*z))/((1+y+y*z)-sqrt((1+y+y*z)^2-4*y*z)));
gradient(f,[x y z])
This is the results:
ans =
-((2*x + 2*y - 2*y*z)/(2*((x + y + y*z)^2 - 4*x*y*z)^(1/2)) - 1)/(2*((x + y + y*z - ((x + y + y*z)^2 - 4*x*y*z)^(1/2))/(y + y*z - ((y + y*z + 1)^2 - 4*y*z)^(1/2) + 1))^(1/2)*(y + y*z - ((y + y*z + 1)^2 - 4*y*z)^(1/2) + 1))
((z + (4*x*z - 2*(z + 1)*(x + y + y*z))/(2*((x + y + y*z)^2 - 4*x*y*z)^(1/2)) + 1)/(y + y*z - ((y + y*z + 1)^2 - 4*y*z)^(1/2) + 1) - ((z + (4*z - 2*(z + 1)*(y + y*z + 1))/(2*((y + y*z + 1)^2 - 4*y*z)^(1/2)) + 1)*(x + y + y*z - ((x + y + y*z)^2 - 4*x*y*z)^(1/2)))/(y + y*z - ((y + y*z + 1)^2 - 4*y*z)^(1/2) + 1)^2)/(2*((x + y + y*z - ((x + y + y*z)^2 - 4*x*y*z)^(1/2))/(y + y*z - ((y + y*z + 1)^2 - 4*y*z)^(1/2) + 1))^(1/2))
((y + (4*x*y - 2*y*(x + y + y*z))/(2*((x + y + y*z)^2 - 4*x*y*z)^(1/2)))/(y + y*z - ((y + y*z + 1)^2 - 4*y*z)^(1/2) + 1) - ((y + (4*y - 2*y*(y + y*z + 1))/(2*((y + y*z + 1)^2 - 4*y*z)^(1/2)))*(x + y + y*z - ((x + y + y*z)^2 - 4*x*y*z)^(1/2)))/(y + y*z - ((y + y*z + 1)^2 - 4*y*z)^(1/2) + 1)^2)/(2*((x + y + y*z - ((x + y + y*z)^2 - 4*x*y*z)^(1/2))/(y + y*z - ((y + y*z + 1)^2 - 4*y*z)^(1/2) + 1))^(1/2))
How should I go about this? Is there another way to do this? Thank you in advance.
  2 个评论
Yazan
Yazan 2021-6-30
Do you know where this function is defined? Namely, the (x, y, z) domain over which your function exists. If yes, then plot the partial derivatives and compare their magnitudes. I have not analyzed your function, but generally, the importance of each variable in defining the rate of change of a function may change over its domain.
dpb
dpb 2021-6-30
Unless you standardize the inputs, the magnitudes of the partial derivatives will be dependent upon the scale of the various variables and so won't mean anything in comparsion to each other.

请先登录,再进行评论。

采纳的回答

John D'Errico
John D'Errico 2021-6-30
Is it possible? Not really. Not using MATLAB or anything else. You have ONE expression. You might describe the "most important" variable as the one where that expression has the largest partial derivative. But depending on where in space you look, those partial derivatives will vary in size. I recall this being called a sensitivity.
But just consider a very simple expression.
syms x y
Z = x^2 + 2*y^2 + x*y;
You might think that y looks a little "more" important, because of the factor of 2 in front.
gz = gradient(Z)
gz = 
But this idea about sensitivity is only relevant if you know the location where you are looking. For example, in the vicinity of the point (x,y) == (3,1), then each variable equally important.
subs(gz,[x,y],[3,1])
ans = 
At the point (-3,1), x is significantly more important.
subs(gz,[x,y],[-3,1])
ans = 
And at the location (-4,1), the importance of y is ZERO.
subs(gz,[x,y],[-4,1])
ans = 
Move a little ways away in a different direction, and we see x now has zero importance.
subs(gz,[x,y],[1,-2])
ans = 
In fact, we can determine a locus for this simple equation where x has zero importance. That is, the locus
gz(1) == 0
ans = 
is the set of all points where x is locally of zero importance to Z. Likewise, we can find the locus of points where y has zero sensitivity, as
gz(2) == 0
ans = 
And of course, for this simple expression, the locus of points where they are of equal importance.
abs(gz(1)) == abs(gz(2))
ans = 
So is what you want to do possible? Yes, and no. Unless you know where to look, the most important variable can easily change.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Classical Control Design 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by