How to load a two-dimensional array using 'From File ' block in Simulink
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to load 2x180 matrix using 'From File ' block and then display it with 'Scope' block in Simulink
the first row of the matrix includes time values [-5.0002 :0.0002: -4.9644 ] and second row includes corresponding amplitude values.
I saved the 'signal_5' (in the attachment) as 7.3 MAT-file format.I arranged the matrix to comply with the following link:
how should I set 'Sample Time' and Simulation Stop time? or any other parameters
Although I tried to do it, I could not display amplitude plot.
4 comentarios
stozaki
el 24 de En. de 2020
Editada: stozaki
el 24 de En. de 2020
Thanks your suggenstion.
Waveform differences are the effect of sampling. The time interval of the data stored in the .mat file is 0.002. In Simulink, the sample rate is 0.002. This seems reasonable when simulating discrete systems.
However, when simulating a continuous system with Simulink, the solver needs to be changed. I attached an example.
When simulating with Simulink, please set an appropriate solver type of configuration set.
This issue is independent of the tool version.
Regards,
stozaki
Respuesta aceptada
stozaki
el 20 de En. de 2020
Please download model and .mat file attached. (created by R2019b)
And execute following script.
model = 'signal_5model'; % define model name
open_system(model); % open model file
cs = getActiveConfigSet(model); % get active congiguration set from model
set_param(cs,'FixedStep','0.0002'); % set sample rate
sim(model,...
'StopTime','0.036'); % simulate until 0.036
The oscilloscope triggers while sweeping the data continuously. Therefore, I think that the data before and after the time to trigger is acquired.On the other hand, Simulink always starts simulation at time 0. Therefore,I modified the format of the data.
Regards,
stozaki
0 comentarios
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!