Function not using given Variables
Mostrar comentarios más antiguos
I'm trying to solve a system of 6 non linear equations using Newton Raphson Method. I defined my equations with 6 inputs (given as initial guesses) and the function returns value after solving it with the inputs.
Then, while trying to calculate Jacobians,
W=jacobian([f(1),f(2),f(3),f(4),f(5),f(6)],[theta,phi,omega,V,alpha1,beta1]);
Jacobian is evaluated and I get the partial derivatives accordingly.
But when I tried calling a function that calculates Jacobian W, with my initial guess. It does not give me a value, rather the partial derivative itself.
function X=jaccalc(input,W);
theta=input(1)
phi=input(2)
omega=input(3);
V=input(4);
alpha1=input(5);
beta1=input(6);
% other variables were also defined
for i=1:6
X(i)=W(i); %I tried assigning a matrix X in hopes that it would calculate the value with the inputs.
end
end
Kindly help me out. And any advice on making the code efficient is also much appreciated
Respuestas (1)
Stephen23
el 20 de Feb. de 2019
0 votos
2 comentarios
Sai Sabarish M
el 20 de Feb. de 2019
Walter Roberson
el 20 de Feb. de 2019
That is your jacobian. Decimal would only be an approximation of the jacobian. But if you really want that then double() the answer you are getting .
Categorías
Más información sobre Newton-Raphson Method en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!