Re: Simulink store/retrieve values during simulation
- From: "Ruud Van der Aalst" <thefonz116@xxxxxxxxxxx>
- Date: Wed, 26 Nov 2008 19:00:17 +0000 (UTC)
Thank you David for your responses. Unfortunately buffers do not work for me.
Is there really no way that you can store and retrieve data values during a simulink simulation like you can do with a written loop in an standard m-file?
I am guessing that it is possible with a c-sfunction but I am totally not familiar with these and after examining a lot of information about this I do not know where or how to start with this for my purpose; do calculations with being able to store them and later during the simulation use them by retrieve for example the total saved time and take the n-th time sample as t(n).
"David" <dave@xxxxxxxxxxxxxx> wrote in message <ggjuri$igl$1@xxxxxxxxxxxxxxxxxx>...
"Ruud Van der Aalst" <thefonz116@xxxxxxxxxxx> wrote in message <ggjr95$hql$1@xxxxxxxxxxxxxxxxxx>....
Thank you for your response. I am familiar with the blocks you suggest but they do not do what I am looking for;
store values during simulation in an array and being able to retrieve specific values ( the n-th sample) during that same simulation.
Normally you can store values to workspace by for example the ToWorkspace block but you can not use that data before the simulation has stopped. But if it has you can get each sample to calculate with for example if you call it x you can take the x(n) to take the nth sample. I would like to retrieve the sample during the same simulation that calculates and stores it.
"David" <dave@xxxxxxxxxxxxxx> wrote in message <ggjq5h$qjj$1@xxxxxxxxxxxxxxxxxx>...
"Ruud Van der Aalst" <thefonz116@xxxxxxxxxxx> wrote in message <ggjnu9$e2d$1@xxxxxxxxxxxxxxxxxx>...
Dear community members,
I hope somebody can help me with the following problem.
I am working with Simulink (fixed-step, ode1) and have the problem that I would like to be able to store samples to a workspace and retrieve them during a simulation.
For example; if you program a normal m-file you can program something like
n=n+1;
dx(n) = xf(n-1)+dx(n-1)*Ts
in a loop. But in simulink??
So I would like to be able to store values and DURING the simulation being able to take a n-th sample that was calculated before. Yes I know that you can use delays for the example but what I would like to program is more complicated than the example so using delays is not an option.
I believe I could use a C-Sfunction to do calculations that can store and retrieve values during a simulation but as I am totally not familiar with C or S-functions I can not get this working.
To be complete; later on I need to build the simulink model using RTW to use it in an experimental setting.
If somebody knows how to do this please let me know because I am struggling on it quite a while now.
Thanks,
Ruud
you may want to look at the 'weighted moving average' block which keeps a memory of so many samples and applies a weighted average to them. or in the signal processing blockset look at the buffer or delay line blocks.
the buffer block lets you do that in a relative sort of way. it keeps up to n previous samples. how many samples do you need to keep? do you have to address relative to the current time or from t=0 for some reason??
- Follow-Ups:
- Re: Simulink store/retrieve values during simulation
- From: Ruud Van der Aalst
- Re: Simulink store/retrieve values during simulation
- From: Phil Goddard
- Re: Simulink store/retrieve values during simulation
- References:
- Simulink store/retrieve values during simulation
- From: Ruud Van der Aalst
- Re: Simulink store/retrieve values during simulation
- From: David
- Re: Simulink store/retrieve values during simulation
- From: Ruud Van der Aalst
- Re: Simulink store/retrieve values during simulation
- From: David
- Simulink store/retrieve values during simulation
- Prev by Date: density plot in matlab
- Next by Date: Re: Mac OS X leopard and Scrolling??
- Previous by thread: Re: Simulink store/retrieve values during simulation
- Next by thread: Re: Simulink store/retrieve values during simulation
- Index(es):
Relevant Pages
|