How to simulate data from txt correctly?

3 visualizaciones (últimos 30 días)
Jose Manuel Velasco Sanchez
Jose Manuel Velasco Sanchez el 23 de Nov. de 2022
Comentada: Jose Manuel Velasco Sanchez el 29 de Nov. de 2022
I'm stuck with an investigation project and I don't have experience in this situations with matlab.
I have to simulate a corrent impulse loading the data from a txt.
The txt has 2 columns, one for time, and the other for intensity.
To import this data to two variables in the workspace and plot them is easy, but the nightmare comes when I want to simulate this data.
I use the block 'from workspace' to load the two variables into simulink, but what is shown in the scope block has no sense.
I think the problem may be with 'time step' or how the time is interpreted, but as far as I have tested it I don’t get any change.
The finality of loading this data and get to simulate it properly, is to see how movs(metal oxide varistors) behaves, so next to the from workspace block I will put some inductors, resistances and the varistor block from simulink with voltage and current sensors.
I have to say that I don't use to ask for help and I look for answers by myself, but now this is getting me in trouble.
Thank you in advance/Gracias

Respuesta aceptada

Mathieu NOE
Mathieu NOE el 23 de Nov. de 2022
hello
I tried to reproduce your problem , but got the right output , not what you show... hope the attached files can help you
I simply created a column oriented array with time in first col and signal in second col
then the simulink model has fixed time stamps (fixed solver , step = dt as declared in m file), no zero crossing detetction, no interpolation...
% some dummy data
Fs = 1e6; % 1 MHz
dt = 1/Fs ;
t1 = (-10:290)*dt; % 100 microS of data
It1 = zeros(size(t1));
It1(20:end) = exp(10000*(-t1(1:end-19)+t1(1)));
plot(t1,It1);
% prepare data for simulink to Workspace block
% For matrix formats, each row of the matrix has a time stamp in the first column
% and a vector containing the corresponding data sample in the subsequent column(s).
t_start = t1(1); % put that in simulation simulation start time
t_end = t1(end); % put that in simulation simulation stop time
simin = [t1(:) It1(:)]; % (:) this makes sure the data are column oriented
  5 comentarios
Mathieu NOE
Mathieu NOE el 28 de Nov. de 2022
%% hello - seems to be running fine even on line !
% some dummy data
Fs = 1e6; % 1 MHz
dt = 1/Fs ;
t1 = (-10:290)*dt; % 100 microS of data
It1 = zeros(size(t1));
It1(20:end) = exp(10000*(-t1(1:end-19)+t1(1)));
plot(t1,It1);
% prepare data for simulink to Workspace block
% For matrix formats, each row of the matrix has a time stamp in the first column
% and a vector containing the corresponding data sample in the subsequent column(s).
t_start = t1(1); % put that in simulation simulation start time
t_end = t1(end); % put that in simulation simulation stop time
simin = [t1(:) It1(:)]; % (:) this makes sure the data are column oriented
Jose Manuel Velasco Sanchez
Jose Manuel Velasco Sanchez el 29 de Nov. de 2022
I will investigate it more, thank you!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by