I need my code to output in both numerical form and symbolical form.
Show older comments
Hello MATLAB Community,
Here is my code:
syms phi theta psi
mobile = 110.75;
d2r = pi/180;
r2d = 180/pi;
phi = 5*d2r;
theta = 10*d2r;
if phi >= 0
psi = -phi ;
elseif phi1 <= 0
psi = -phi ;
end
ROT = [(cos(phi)*cos(psi))-(cos(theta)*sin(phi)*sin(psi)) -(cos(phi)*sin(psi))-(cos(theta)*cos(psi)*sin(phi)) (sin(phi)*sin(theta));...
(cos(psi)*sin(phi))+(cos(phi)*cos(theta)*sin(psi)) (cos(phi)*cos(theta)*cos(psi)-sin(phi)*sin(psi)) -(cos(phi)*sin(theta));...
(sin(theta)*sin(psi)) (cos(psi)*sin(theta)) cos(theta)];
x = (mobile/2)*(ROT(1,1)-ROT(2,2))
y = -mobile*ROT(2,1)
So, when you run this code, you get results of x & y in numerical form.
I want my code to output in two forms numerical and in symbolical (in terms keeping x & y as equations).
I tried some ways to achieve it and after verification I saw that the numerical answer won't match the solutions of the equations generated.
When my x & y are in equation form, I can use these equations for differentiation in the later part of my code.
Can anyone please help me with this,
Thank you,
Shiv
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!