Implementing a complex function in Simulink

1 次查看(过去 30 天)
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?

采纳的回答

Kaustubha Govind
Kaustubha Govind 2013-5-13
The only other alternative I can think of is to use the MATLAB Function block and write this out as a MATLAB function.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by