# i have a problem ,

8 Ansichten (letzte 30 Tage)
mohammed elmenshawy am 24 Dez. 2016
Kommentiert: Walter Roberson am 4 Jan. 2017
A summary of what I want to do . i have function of 3 parameters L=f(x,y,z). i need differential this function with respect to x , y and z , and equality them by zero. Hence we get three equations in three parameters , Give initial values of the three parameters. In the first equation, which is where the differentiation for x we substitute only about y and z to get x value . By this logic with the y and z . what to do ?
##### 2 KommentareKeine anzeigenKeine ausblenden
John BG am 24 Dez. 2016
let the readers work on the equations by making them available here, either copy them or attach the MATLAB script with the equations.
Walter Roberson am 25 Dez. 2016

Melden Sie sich an, um zu kommentieren.

### Antworten (2)

Roger Stafford am 24 Dez. 2016
If the derivatives of f with respect to x, to y, and to z are always zero, that means f must be a constant. Whatever the initial conditions for f(x,y,z), f must remains fixed at that initial condition.
##### 3 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Roger Stafford am 24 Dez. 2016
@Star. I interpreted his statement, “i need differential this function with respect to x , y and z , and equality them by zero” to mean “I need to differentiate this function with respect to x, y, and z, and to equate these derivatives all to zero”, which doesn’t sound like a problem in optimization.
Walter Roberson am 24 Dez. 2016
I read it as wanting to solve for the point where the three partial derivatives are all zero.
However it is not necessarily a minimization since the partials would also all be zero at maxima or saddle points.

Melden Sie sich an, um zu kommentieren.

John BG am 4 Jan. 2017
1.
try function gradient on the function f(x,y,z) to obtain the 3D function to solve
note that gradients (AKA directional derivatives) vary according to the chosen coordinate systems:
define the resulting function out of gradient with gradf(x,y,z) , in example:
function t1=fun1(x)
t1=exp(-x(1).^2-x(2).^2-x(3).^2)
and then
problem.objective=@fun1
problem.x0=[0 0 0]
problem.solver='fsolve'
problem.options = optimoptions('fsolve','Display','none','PlotFcn',@optimplotfirstorderopt);
fsolve(problem)
is it possible for you to supply along your question the function that you want to calculate the gradient and solve?
.
thanks in advance for time and attention
John BG
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Walter Roberson am 4 Jan. 2017
The user is looking to create three equations: 1) the gradient of arbitrary function f with respect to x, in terms of only y and z; 2) the gradient of f with respect to y, in terms of only x and z; and 3) the gradient of f with respect to z, in terms of only x and y. The user then wants to solve those three equations simultaneously.
Unfortunately, in the general case, the gradient of a function with respect to a variable typically involves the variable as well.
A modification would be to take the gradient with respect to x, and solve that gradient equal to 0 with respect to x, and then to substitute that x into the gradient with respect to y. Then that gradient could be solved equal to 0 for the variable y. Then substitute the x found into the gradient with respect to z, and then substitute the y found into that, giving a gradient with respect to z that involves only the variable z; you can then equate that to 0 and solve for z. You can then back substitute to get y, and then back substitute the z then y to get x. There would generally be multiple solutions as the solutions would include all of the maxima, all of the minima, and all of the saddle points.
The procedure I describe is not what the user asked to do: the user expected the x to disappear automatically from the gradient with respect to x, and so on, leaving three equations in two variables each that could then be numerically solved for.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Logical finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by