How to incrementally save output data from long Simulink simulation?

Hey everyone,
I'm using Simulink to compute the response of a linear, parameter varying system (LPV system). Within the simulation 24h data shall be generated with a sample frequency of 800 Hz. I'd like to save the output incrementally every 10 minutes.
My question is: How can I perform these blockwise savings?
Thanks
Stefan

 Akzeptierte Antwort

You can specify the start and stop time of the simulation. The key point is to save the final state of the last simulation and use it as the initial state of the next simulation. Below is an example, you can change the loop number and insert the save command inside the loop to save your data.
vdp;
tStart='0';
tStop='10';
out=sim('vdp','StartTime',tStart,'StopTime',tStop,...
'SaveFormat','Structure',...
'SaveFinalState','On','FinalStateName','xFinal');
for k=1:1
tStart=tStop;
tStop=num2str(10+k*10);
x0=out.xFinal;
out=sim('vdp','StartTime',tStart,'StopTime',tStop,...
'SaveFormat','Structure',...
'LoadInitialState','On','InitialState','x0',...
'SaveFinalState','On','FinalStateName','xFinal');
end

1 Kommentar

Hey,
this is also the solution I finally implemented successfully. Many thanks.
Stefan

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by