Writing functions in MatLab -
i'm been ask jacobian in matlab solve coordinates highest value f(x) , max value same function.
the function have work : f(x; y) = (x^3y + 5x^2y^2)/ e^(x^2+3y^4)
so have accomplished far:
function [j1,j2]=j(x) [3*x(1)^2+20*x(1)*x(2)-36*x(1)^2*x(2)^4-120*x(1)*x(2)^5,10*x(1)^2-48*x(1)^3*x(2)^3-300*x(1)^2*x(2)^4;6*x(1)*x(2)+10*x(2)^2-8*x(1)^3*x(2)-30*x(1)^2*x(2)^2,3*x(1)^2+20*x(1)*x(2)-2*x(1)^4-20*x(1)^3*x(2)] end
i believe matrix including 4 derivatives of f(x)
. nut don't know how solve 2 questions.
the answer given in comments, make sure question not remain unanswerd post here:
first wrote jocobian matris
function = j(x) j11 = 6*x(1)*x(2)+10*x(2)^2-8*x(1)^3*x(2)-30*x(1)^2*x(2)^2; j12 = 3*x(1)^2+20*x(1)*x(2)-2*x(1)^4-20*x(1)^3*x(2); j21 = 3*x(1)^2+20*x(1)*x(2)-36*x(1)^2*x(2)^4-120*x(1)*x(2)^5; j22 = 10*x(1)^2-48*x(1)^3*x(2)^3-300*x(1)^2*x(2)^4; = [j11, j12;j21, j22]; end
then used function estimate criticalpoints
function xnp1 = newtonmultyvar(x0,n); xn = x0; n = 1:n xnp1 = xn - inv(j(xn))*z(xn); xn = xnp1; end end
where x0
youre approximated point , n
stands number notations.
Comments
Post a Comment