I'm fairly new to matlab and have written the following function to use in the fsolve command.
function F = myfun(x)
F(1)=cos(phi3)+7*cos(x(2))-5*cos(x(5))+7*cos(x(1))-3*cos(phi2);
F(2)=sin(phi3)+7*sin(x(2))-5*sin(x(5))+7*sin(x(1))-3*sin(phi2)+4;
F(3)=2*cos(phi4)-14*cos(x(3))-5*cos(x(6))+7*cos(x(4))-2.5*cos(x(5))+7*cos(x(1))-3*cos(phi2);
F(4)=2*sin(phi4)-14*sin(x(3))-5*sin(x(6))+7*sin(x(4))-2.5*sin(x(5))+7*sin(x(1))-3*sin(phi2)+7;
F(5)=2*cos(phi4)-14*cos(x(3))-5*cos(x(6))+7*cos(x(4))+2.5*cos(x(5))-7*cos(x(2))-cos(phi3);
F(6)=2*sin(phi4)-14*sin(x(3))-5*sin(x(6))+7*sin(x(4))+2.5*sin(x(5))-7*sin(x(2))-sin(phi3)+3;`
For the next part of my problem. I would like to use the derivatives of F(1) to F(6) with respect to x(1), x(2), .. x(6) I would like to write some code e.g. in the command window which could do this job for me and produce the new functions with the derivatives in it. (of course I can easily do it by hand, but it would be a nice implementation)
I have already tried various options with the diff command but can't seem to manage it.
I use this function as x=fsolve(@myfun,[a],options) with a being the initial values for x(1)..x(6) Now I want to generate from F(1)..F(6) new functions G(1)..G(6) which look like G(1)=-sin(phi3)dphi3/dt-7sin(x(2))dx(2)/dt+5sin(x(5))dx(5)/dt... In this equation I will fill in the results from fsolve and then further use them to solve for x(2)/dt (which are angular velocities)