f



MATLAB discrete time simulation of simulink model (Control simulink simulation time from MATLAB)

I am trying to run a simulink model simulation in definite time steps from MATLAB so that I can extract data from simulink, do some caluclations and send these new data back to Simulink for further simulation from the point I left off. 

The process can be descirbed below: 

Note that total simulation time is 600 seconds.

1. Start simulation from MATLAB for 100 seconds and then pause the simulation
2. Extract all the data I need from simulink and bring into MATLAB, do some calculations to changes simulink model parameters and then pass this new calculated data back to simulink.
3. Continue the simulation where I left off (i.e. from 100 seconds) but this time in 15 second intervals, up to total simulation time end (repeating step 2 and 3 after every 15 seconds).

Can someone please advise if they have done this before and what command structures they used. Thank you.

True.
0
e8342lec (2)
4/28/2009 4:50:02 AM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
2408 Views

Similar Articles

[PageSpeed] 54

You can "sim" to achieve this. Try "help sim" to learn details.

Yi

"High Voltage" <e8342lec@yahoo.com> wrote in message <gt61tq$657$1@fred.mathworks.com>...
> I am trying to run a simulink model simulation in definite time steps from MATLAB so that I can extract data from simulink, do some caluclations and send these new data back to Simulink for further simulation from the point I left off. 
> 
> The process can be descirbed below: 
> 
> Note that total simulation time is 600 seconds.
> 
> 1. Start simulation from MATLAB for 100 seconds and then pause the simulation
> 2. Extract all the data I need from simulink and bring into MATLAB, do some calculations to changes simulink model parameters and then pass this new calculated data back to simulink.
> 3. Continue the simulation where I left off (i.e. from 100 seconds) but this time in 15 second intervals, up to total simulation time end (repeating step 2 and 3 after every 15 seconds).
> 
> Can someone please advise if they have done this before and what command structures they used. Thank you.
> 
> True.
0
y.cao (356)
4/28/2009 7:48:03 AM
"set_param()" can help too.
you can adjust almost everything with this command.
in the help is a list with all detailed commands
0
barr (3)
4/28/2009 8:26:05 AM
Reply:

Similar Artilces:

Real-time control with Matlab/Simulink
Greetings, I am trying to control a robotic arm that performs a high speed task using a model in Simulink. The arm has it's own server that communicates with the control computer via UDP protocol. The problem that I am experiencing is very low task repeatability. This seems to be due to execution time beeing non-linear where it should be linear. One of the reasons for this is that outside processes are interrupting matlab while the task is beeing executed. I tried closing as many as possible, but the problem still persists. I also tried using real-time windows target, but it wouldn't ...

Matlab keeps crashes time after time when using Simulink
Hi, every time I use SIMULINK (just programming) Matlab keeps crashing in random intervals. First Matlab states: 'MATLAB hat ein Problem festgestellt und muss beendet werden.' (~ Matlab encountered a problem and has to be stopped) Afterwards Matlab crashes/quitts . I appritiate any ideas. Thanks, Michael Hello Michael, i am having the same problem. were u able to resolve it ?? thanks. Michael Schiek wrote: > > > Hi, > every time I use SIMULINK (just programming) Matlab keeps crashing > in > random intervals. > First Matlab states: > 'MATLAB hat ein Pro...

MATLAB: How do you simulate a simulink model using a string?
Hey guys can you please help with this, I just cant get it. I have a simulink model with the name BusAssignment and with that I have an edit box inside a GUI with a string BusAssignment. I am trying to get the mfile to read the String and simulate it as it is the name of the simulink model. At the moment I have the follow piece of code for that section SimulinkName = get(handles.simulinkname, 'String'); %takes the simulink model name sim(SimulinkName) %runs the simulink model SimulinkName gives back BusAssignment but when it goes to sim it trys to simulate SimulinkNa...

Matlab simulation time
Hi guys: Could you help me with my simulation time of matlab? My question is how to set the matlab when I test the performance of my simulation. The situation is that I need to run my simulation more than 50 times and I do not need to restart my simulation every time. I just run once and I can get 50 results at the same system. Then I can let my computer work by itself and I can do other job. Thank you very much. frigile Hi Figile! Use the sim command. U have to type the simulation time as parameter in the command. I use Out blocks (usually for the subsystems) with the variable as bloc...

Timing in matlab simulation
hello for my simulation, i need to do timing - a function to run on constant time delays, no matter what (for example during the simulation, the program should do measurements on constant time interval, meanwhile it do some calculation on the measurments) how do i do it? Hello Michael, You could use: pause on for i = 1:n pause(n) your simulation function.... end with n a nonnegative real number (when the time interval is not too small because for high resolution there can be high relative error). If exactness is important at small time scales you should check out inf...

Time-varying State-Space Model in MATLAB/Simulink
Dear All, Please let me know how to implement a time-varying SS model in MATLAB/Simul= ink (SL). I am using MATLAB R2011a. I am using State-Space block in Simulin= k library to specify my A, B, C, D matrices. But here the problem is the el= emnts of the matrices will change after certain time during the simulation = or it may change continuously. Is there any way to implement this in MATLAB= /SL? Regards Samiran. ...

Stateflow Model Simulation error in Matlab Simulink Environment.
Hi all, I am trying to simulate a STATE-FLOW model of a Single Input and Single Output system. The error which I am getting on Simulation is "Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler." Please suggest me the necessary action that can be taken for the ERROR RECTIFICATION. Thanks in advance. Sumanta Kumar Show Research Scholar National Institute Of Technology Karnataka Surathkal India "Sumanta " <show.sumanta@rediffmail.com> wr...

how to simulate a Simulink model step by step from Matlab command window?
I know we have to use model_name(t,x,u,flag) command but even an extremely simple model gives the following error message "One or more output arguments not assigned during call to 'model_name'." Does anybody have an example for step by step simulation of a Simulink model? Thanks, Oguz You may consider running simulink debugger. Oguz Dagci wrote: > > > I know we have to use model_name(t,x,u,flag) command but even an > extremely simple model gives the following error message > > "One or more output arguments not assigned during call to >...

How can I use a Matlab function, whose inputs varies with time (real time function), in simulink
Hello I need your help I would llike to know how can I use a Matlab function, whose inputs varies with time (real time function), in simulink. Thank you in advance Hiba ...

Re: how to simulate a Simulink model step by step from Matlab command window?
could you help me. rasool wrote: > > > could you help me. > > help sim ...

MATLAB/Simulink and Source Control (MKS Client). MATLAB Performance Improvement.
I'm looking for two things. Help with either one would be most appreciated. 1) I have a MATLAB GUI that runs a series of scripts. It makes use of the fixed point toolbox (fi objects and quantizer objects) and those things make it VERY slow. I have rewritten the quantizer and made my own quantizer m function. But, it doesn't warn me about overflows or underflows (which I suppose I could code up). Just the same, it'd be nice to go from MATLAB scripts and function to machine code if that's possible. 2) We use MKS Integrity Client 2006 for software source control. ...

vehicle simulation
hi there, i am currently developing a vehilce simulation model using matlab simulink. The simulation requires a vehilce to be simulated travelling around a simple race track. the vehilce model itslef has already been created and have all necessary vehicle input data for the simulation. the problem i have is that i have to simulate the vehicle approaching a corner from a straight line and decelerating at first 0.4g and then 0.8g, so that it travels around the corner at 10m/s. therefore i need to have a function that will determine the braking point relative to the stopping distance, (obviously ...

a matlab simulink simulation problem
Hellow everyone! I meet a error warning which was "Input data dependency violation due to action subsystems. See Subsystem Examples in the Simulink library for valid and invalid examples of action subsystems". I know a way out. "Just for info putting a unit delay at the input can hopefully solve your problem,"Someone said. There's no error in my control system afer adding a unit delay at the input of the controller, but another problem finds me. The system is unstable. For the unstable system, the object is built by S-Function. Otherwise, for the same con...

MATLAB and SIMULINK real time
hi all, I have to change a variable in simulink real time model when this model is running. I need to change it in matlab command line, how I can do this? Anyone know some examples? MarioItalia wrote: > > > > hi all, > > I have to change a variable in simulink real time model when this > model is running. I need to change it in matlab command line, > how I can do this? Anyone know some examples? > > > > > Mario, have a look at "external mode". Matlab can't intefere with a Simulink process, normally. Check Simulink helps & docs,...

PSK Simulation
I created the same PSK simulation in Matlab and in Simulink. Both models simulate BPSK data being passed through an AWGN channel. Even though these simulations are the same, I get different results. Is there a difference between "AWGN" command and the "AWGN" block? Or is there a difference between "pskmod" and the "BPSK" block? Thanks ...

Simulation time in a MATLAB-Function
Hi experts, I want to get the "simulation time" in a (embedded) MATLAB-Function. In a Simulink-Block the simulation time can get by the "Clock"-block, which outputs the current simulation time at each simulation step. I want to do the same in an (embedded) MATLAB-Function! Is there any command or something else to get the simlation time (NOT the current date&time!) ? Thanks to all experts! Bernd ...

Matlab to Simulink in real time
I'm trying to use Matlab workspace data as input for Simulink instead of a joystick or mouse. Admittedly, I'm pretty inexperienced with both programs, so I can't figure out how to do this. The "From Workspace" block only takes data from the Matlab workspace at the start of the Simulink model. How can I constantly send data from Matlab to Simulink throughout the simulation? Thanks ahead of time. "James Yamada" <jamesyamada@gmail.com> wrote in message <go990h$2ba$1@fred.mathworks.com>... > I'm trying to use Matlab workspace data as input for Si...

Use unevenly spaced measurement time series from MATLAB workspace as input for Simulink model
Hello, I'm currently trying to verify an Error State Space Kalman Filter algorithm with real measurement data. My Simulink model shall run at discrete 0.005 s time steps (200 Hz). I discretized and rounded the time vectors given by the devices to 0.005 s to fit the Simulink model. One of the data vectors, that is used to update the filter in a lower frequency about 8 Hz, has unevenly spaced timestamps ranging from 0.1 s, 0.125 s to 0.15 s, yet still in a 0.005s resolution. I want the Kalman Filter to perform the update with the measurement data at the exact time steps given in the time ...

How to get simulink simulation time to be the same as actual time.
Hello everyone, I am using trying to use simulink as a controller for an experiment using a data acquisition board to read in instrument signals and send out command signals real time. I am having a few issues and I believe that all of these could be resolved if I could just get the simulation time to be real time. What I mean is that if I use a fixed time step of .01 seconds and have a simulation time of 10 seconds then I want the simulation to last 10 seconds and have a delay of .01 seconds between each time step. Is there a way to do this or is there a tutorial I should read for how t...

how can i use my time as simulation time in Simulink?
i type the following commands to set the simulationstime of matlab. lw = [ttc', lwc']; rw = [ttc', rwc']; rg = [ttc', rgc']; tt=[ttc', ttc']; [ts,xs,ys] = sim('EBM_P2',tt(end),[],lw,rw,rg,tt) my time has the value 1x332 double ,but ts has the value 415x1 double. ts has the value 1x despite of giving the time("ttc") matlab use his simulationtime. how can set my time as simulationtime? please answer me. thanks for your helping. ...

Sequencial calling to Simulink during a MATLAB simulation
I have a compex MATLAB simulation model of an aircraft. The simulation uses MATLAB's ode45 solver to integrate the equations of motions in time. I'm trying to implement a flight control system (FCS) in SIMULINK which will continuosly provide the required control commands to the simulation during each integration step (using the "sim" command). The only way I could achieve this is: 1. Integrate the aircraft state equations during a short time interval (say dt). 2. Call the sim command using the current aircraft states (speed, angular rates, etc...) and the last step compl...

Matlab Simulink Coupler Simulation Problem
Dear All, I am trying to do some Matlab Cadence co simulation following the AVUM Workshop included in Cadence Distribution. My circuit is a very simple CMOS inverter. I am providing the Pulse Input to the inverter from Matlab/Simulink though the coupler and feeding back the output of the inverter to Matlab/Simulink by the coupler. I am noticing that whwever the square pulse is going through the coupler from Matlab to Cadence, it is getting converted into Triangular Pulse. And hence my circuit is not functioning properly. How can I make it work properly? I am using the following: Matlab Vers...

Getting a Matlab plot during simulation in simulink
Hi I want to plot the output from my simulink model during simulation using a matlab plot, (because u cannot do editing on the simulink scope or XY graph), How to obtain the Matlab plot during simulation which gives the complete simulation result. Hector You could use the time series tools in R14sp3 (inspect signals check box in data I/O configuration paramaters) which allows this, or you could pause the model then look at the signals yourself if you are using to workspace blocks, or you could make your own scope from an m-code s-function to do the plotting. Stuart "Hector" &l...

Time varying filter in Matlab (not simulink)
I see that simulink has a way to implement filters where the coefficients change on a per sample basis. Is there an equivalent thing in regular matlab? I could make it myself but it might be painfully slow if I had to implement nearly every multiply in an m-file. ...

Web resources about - MATLAB discrete time simulation of simulink model (Control simulink simulation time from MATLAB) - comp.soft-sys.matlab

Simulation - Wikipedia, the free encyclopedia
... or behaviors/ functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation ...

Simulation - Wikipedia, the free encyclopedia
... or behaviors/ functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation ...

Simulation - Wikipedia, the free encyclopedia
... or behaviors/ functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation ...

Simulation - Wikipedia, the free encyclopedia
... or behaviors/ functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation ...

Glu Launches Kendall & Kylie Lifestyle Simulation Game on Mobile
... the release of Kendall & Kylie, its latest celebrity mobile game on iOS and Android. Starring Kendall and Kylie Jenner , the lifestyle simulation ...

Computer simulation fills in the blanks of Neanderthal extinction
A modern human and Neanderthal skull face off. (credit: By hairymuseummatt (original photo), DrMikeBaxter (derivative work) [CC BY-SA 2.0 (h ...

Shooting Simulations: What Do They Tell Us
Earlier, Anne Laurie posted about the recently staged, weapons free, mass shooting simulation/demonstration at the University of Texas. In that ...

Madden Super Bowl 50 Simulation: EA Sports Predicts Panthers vs. Broncos Winner - Bleacher Report
... got in Super Bowl 50? If you're having a hard time picking a winner, perhaps you'd like to know that the official EA Sports Madden NFL 16 simulation ...

A London startup that wants to be the 'Google of simulation' is building an entire virtual city
Improbable, a London startup that claims it wants to be the "Google of simulation" is officially launching its operating system today — as well ...

'95-96 Bulls vs. '15-16 Warriors: New age tops old school in 2K simulation
We let the '96 Bulls and '15 Warriors handle their business on the virtual hardwood to see which one is better.

Resources last updated: 2/25/2016 1:41:29 AM