mfile version of Simulink integrator

5 visualizaciones (últimos 30 días)
Scott Hansen
Scott Hansen el 16 de Jul. de 2013
Comentada: Jorge Gustavo Vazquez Duran el 23 de Nov. de 2016
I'm running a simulation model in Simulink and I want to transform it over to m-code. In my Simulink model I use an integrator and to be sure I was making my m-code correctly I took time-stepped data on both sides of the integral and compared to when I ran those points through my m-code. Sadly they did not match up.
The solver I am using in Simulink is ode3 ... does anyone know the formula for the integrator block in Simulink using an ode3 solver?
BTW, I do not have the toolboxes to do code generation from simulink.
  3 comentarios
Scott Hansen
Scott Hansen el 17 de Jul. de 2013
Because I need to for what I'm working on ... why is that relevant to the question?
Jorge Gustavo Vazquez Duran
Jorge Gustavo Vazquez Duran el 23 de Nov. de 2016
hi man, i don´t have a solution but i have the same problem like you.
did you solve this or keeping it??
thanks.! regreat!!

Iniciar sesión para comentar.

Respuestas (1)

Guy Rouleau
Guy Rouleau el 16 de Jul. de 2013
This should get you started:
You might also be interested to look at the code for the ode3.m function in MATLAB.
  1 comentario
Scott Hansen
Scott Hansen el 17 de Jul. de 2013
Editada: Scott Hansen el 17 de Jul. de 2013
I was looking at that exact page yesterday but had a hard time figuring out how to implement the equations. Please let me explain my confusion and hopefully you can point me in the right direction.
My format looks like this:
xdot -----> 1/s -----> x
xdot = input to integrator (acceleration in my system)
1/s = integrator
x = output of integrator (velocity in my system)
So I have time stamped data sets for xdot and x.
When it comes to the wiki page you recommended ... these equations are usually used to determine the next x value from previous values of x (at least that is how I understand it). When looking at the equations on the wiki page I'm not confident which variables are xdot, x and so forth. My understanding is below:
h_n = timestep from x_n to x_n+1
t_n = time at y_n
k1, k2, ... = calculated multipliers
y_n' = f(t_n, y_n) = xdot
y_n = x
If this is all correct then my next issue is that I don't have a function to evaluate these at (and neither does the integrator). It doesn't know what the next xdot value will be until it is applied as an input ... so how can I estimate the x value without an understanding of this?
I apologize for the length of this email but I'm really needing some assistance with this. Thanks in advance for your help.
S

Iniciar sesión para comentar.

Categorías

Más información sobre General Applications en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by