Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- syms r th ph
- M = [cos(th)*sin(ph), sin(th)*sin(ph),cos(ph);];
- M(2,:) = [-r*sin(th)*sin(ph), r*cos(th)*sin(ph),0];
- M(3,:) = [r*cos(th)*cos(ph), r*sin(th)*cos(ph),-r*sin(ph)];
- invM = simplify(inv(M));
- syms Fr Fth Fph
- V = [Fr; Fth; Fph];
- output = invM*V;
- display(output)
- syms r th ph
- f = symfun(sym('f(r,th,ph)'),[r th ph]);
- A = diff(f,r)*cos(th)*sin(ph) + (diff(f,ph)*cos(ph)*cos(th))/r - (diff(f,th)*sin(th))/(r*sin(ph));
- B = diff(f,r)*sin(ph)*sin(th) + (diff(f,ph)*cos(ph)*sin(th))/r + (diff(f,th)*cos(th))/(r*sin(ph));
- C = diff(f,r)*cos(ph) - (diff(f,ph)*sin(ph))/r;
- A2 = diff(A,r)*cos(th)*sin(ph) + (diff(A,ph)*cos(ph)*cos(th))/r - (diff(A,th)*sin(th))/(r*sin(ph));
- B2 = diff(B,r)*sin(ph)*sin(th) + (diff(B,ph)*cos(ph)*sin(th))/r + (diff(B,th)*cos(th))/(r*sin(ph));
- C2 = diff(C,r)*cos(ph) - (diff(C,ph)*sin(ph))/r;
- L = simplify(A2 + B2 + C2);
- pretty(L)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement