Clear Filters
Clear Filters

Implementing a complex function in Simulink

5 views (last 30 days)
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?

Accepted Answer

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

More Answers (0)

Categories

Find more on General Applications in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!