cos block error (simulink)
Mostrar comentarios más antiguos
why is this happen?
cos(pi/2) = 6.123e-17??

Respuesta aceptada
Más respuestas (1)
Paul
el 14 de En. de 2023
0 votos
Base Simulink doesn't have a block that implements functions cosd or cospi. Maybe some other toolbox does. If not, both of those functions support code generation so you can use the Matlab Function block and call either (or both of them) from there.
5 comentarios
Paul
el 15 de En. de 2023
Does the Spherical to Cartesian block come with Simulink or one of the toolboxes or blocksets from the Mathworks? If so, please provide a link to the doc page. If not, do you have access to the block implementation?
기범
el 16 de En. de 2023
I couldn't add it because I couldn't find it, which is why I asked for the doc page. Did you find that block in one of The Mathworks products in the Simulink Library browswer? If so, which one?
Anyway, if you want to use degrees instead of radians in your model, it looks like you can implement the three equations in that block in your own Matlab Function using cosd and sind.
기범
el 17 de En. de 2023
Paul
el 17 de En. de 2023
I never said to use syms. I did say to use cosd, etc. if you want have all your angles defined in degrees. So, if theta, phi, and psi are all in degrees on input, then we have
x = r.*sind(phi).*cosd(theta)
and similar for y and z
Categorías
Más información sobre Variables 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!

