Hi,

I have this Cost Function H = 1/(deltaX)2 [(A2 - A1)2 + (A3 - A2)2 + (A4 - A3)2]

I'd like to minimize this cost function by forming the derivatives of our function's variable. then we have :

dH/dA1 = 2/(deltaX)2  ( - A2 + A1)

dH/dA2 = 2/(deltaX)2  (-A1 + 2A2 - A3)

dH/dA3 = 2/(deltaX)2 (-A2 + 2A3 - A4)

dH/dA4 = 2/(deltaX)2 (A4 - A3)

first I need to write the MATLAB code for above example and the next step is , every where which there is A2, instead of that I would like to put (A1 + A3 + A4)

so eventually my function should be like this:

H = 1/(deltaX)2 [((A1 + A3 + A4 ) - A1)2 + (A3 - (A1 + A3 + A4 ))2 + (A4 - A3)2]

and then forming the partial derivatives of our function's variables the same as above mentioned. 

Thank you

Similar questions and discussions