Function not using given Variables
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Stephen23
on 20 Feb 2019
2 Comments
Walter Roberson
on 20 Feb 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 .
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!