Effacer les filtres
Effacer les filtres

Implementing a complex function in Simulink

6 vues (au cours des 30 derniers jours)
Pieter
Pieter le 12 Mai 2013
In Matlab's command window I obtained several equations which look like:
Tc1 = (- 2*J2*cos(t3)*sin(t1)*sin(t3)*n^2 + 2*J2*w3*sin(t3)*n)/cos(t2) - d2 + cos(t2)*(J2*cos(t3)*sin(t1)*sin(t3)*n^2 + J2*v3*sin(t1)) + J1*w1*w3 + J2*w1*w3 - J3*w1*w3 + J2*v2*cos(t1) + J2*n^2*cos(t1)*tan(t2) - J2*w2^2*cos(t1)*tan(t2) + 2*J2*w3^2*cos(t1)*tan(t2) + J2*w2^2*cos(t1)^3*tan(t2) - J2*w3^2*cos(t1)^3*tan(t2) - 2*J2*n*w2*cos(t3)*tan(t2) + 2*J2*w2*w3*sin(t1)*tan(t2) - J2*n^2*cos(t1)*cos(t3)^2*tan(t2) + 2*J2*n*w2*cos(t1)^2*cos(t3)*tan(t2) - 2*J2*w2*w3*cos(t1)^2*sin(t1)*tan(t2) - 2*J2*n*w3*cos(t1)*cos(t3)*sin(t1)*tan(t2)
In Simulink I use From and Goto blocks for all the parameters (Tc1, J1, J2, J3, t1, t2, t3 and so on).
Now I am wondering what the easiest way is to implement these long formulas in Simulink for a simulation. Normally I would just rebuild the equations using all kind of blocks in Simulink, but the equations I ended up with this time are much longer. Any ideas?

Réponse acceptée

Kaustubha Govind
Kaustubha Govind le 13 Mai 2013
The only other alternative I can think of is to use the MATLAB Function block and write this out as a MATLAB function.
  1 commentaire
Pieter
Pieter le 14 Mai 2013
Thank you, that works fine!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur General Applications dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by