Differential equation in embedded block in simulink ?
Mostra commenti meno recenti
Dears all,
I have a simulink with several degreees of freedom (springs, mass and damping). I try to replace a part of it by an embedded function containing a differential equation coded with matrix mass, stiffness and damping.
My problem is to make simulink understand that in the embedded function there is a differential equation (X ==> dX)
If the embedded function is not link with other simulink object, i can't put an integrator on the output and feed it into the input of the block.
If i replace one spring (with little mass on each extremity) and try to say displacement on my first mass is the same that displacement on the mass before in the simulink model (X(n-1)=X(n)) that is feeding my embedded function with the output of the mass before in simulink. The model does'nt run well. I think it's because i can't loop the output of the emebedded block in its input so simulink doesn't understand that its a differential equation.
Is there any solution ?
I hope my question is understandable....
Thanks a lot for your help.
Risposta accettata
Più risposte (1)
Guy Rouleau
il 14 Mar 2012
2 voti
If you need to generate code and consequently use the EML block, you might want to use the trick described here:
The trick is to generate Dx in the EML block, feed that to an integrator that will compute x and feed that back to your EML block.
1 Commento
Rishabh singh
il 19 Mag 2020
thank you sir, your trick was helpful for me.
Categorie
Scopri di più su Simulink Coder 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!