How can i make a simulink model of a .m file?

1 visualización (últimos 30 días)
Umair Khan
Umair Khan el 13 de Oct. de 2016
Respondida: Swarooph el 13 de Oct. de 2016
I have an .m file which defines a state space and then plots its impulse response. Now, I want to make a Simulink model of this. As I am not familiar with Simulink, can anyone help me in finding an easy way to create a Simulink model directly from the .m file?
Here I provide the code in the .m file:
-------------------------------------------------------
k=11.417;
L=0.8603;
Jm=12e-6;
JI=235e-6;
a=k/Jm;
b=k/JI;
A=[0 1 0 0;-a 0 a 0;0 0 0 1;b 0 -b 0];
B=1/Jm*[0;1;0;0];
C=[0 1 0 0;0 0 0 1];
D=zeros(2,1);
plant=ss(A,B,C,D);
impulse(plant,0.025);
--------------------------------------------------------
Thanks

Respuesta aceptada

Swarooph
Swarooph el 13 de Oct. de 2016
Short answer,
In general, there is no magic function or button that will convert your MATLAB code into Simulink model. However there maybe some specific toolbox utilities that can help do this for specific functionalities. I am not aware of such a way to create state space models though.
Long answer,
  1. Learn the basics of Simulink. This tutorial might be a good place to start.
  2. In your case, you can try to use the built in State space block in Simulink. Documentation is here.
  3. You can also use the general LTI block in the Control Systems Toolbox to import the 'ss' state space object from the MATLAB base workspace into Simulink. Take a look at its documentation here.

Más respuestas (0)

Categorías

Más información sobre Simulink Environment Customization en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by