The script steepestdescent.m optimizes a general multi variable real valued function using steepest descent method. During the iterations if optimum step length is not possible then it takes a fixed step length as 0.001. For the theory any good book on optimization techniques can be consulted. This script is also useful in checking whether a given function is convex or concave and hence globally optimizable.
i try the program but it gives an error:
Error using mupadengine/feval (line 157)
MuPAD error: Error: A variable to solve for is required. [solve]
Error in solve (line 170)
sol = eng.feval('symobj::solvefull',eqns,vars);
Error in steepestdescent (line 102)
I am new to MatLab and was wondering how would I enter the following function in "proper format" since I try with no avail. I could appreciate some idea on how to do that. The functions itself is:
PE(x1,x2) = .5*K1*[sqrt(x1^2+(L1-x2)^2)]^2+.5*K2*[sqrt(x1^2+(L2+x2)^2)]^2-P1*x1-P2*x2
Where, K1, K2, P1, and P2 are constant. Thank you.
Not a function, so it pollutes the Command Window workspace. Prompts the user for all input including the function to be optimized! Does not require symbolic math toolbox as stated. Has at least one triple nested For loop. Does not appear to use any vectorization.
Why not write this as an m file? I'm not sure what the symbolic toolbox buys you. 3 stars only because you used a toolbox I have no need for and no intention of buying.
A small error has been rectified.