cos block error (simulink)
Mostra commenti meno recenti
why is this happen?
cos(pi/2) = 6.123e-17??

Risposta accettata
Più risposte (1)
Paul
il 14 Gen 2023
0 voti
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 Commenti
Paul
il 15 Gen 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?
기범
il 16 Gen 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.
기범
il 17 Gen 2023
Paul
il 17 Gen 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
Categorie
Scopri di più su Variables in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

