Borrar filtros
Borrar filtros

How can i get required number of sample from simulink to workspace?

1 visualización (últimos 30 días)
I have a synchronous generator model and it runs for an interval 0 to 50 sec.Finally i get current output in three phase and the size of my current values passed is 1000001x1 but i can use only 1001x1 values for further calculation. How can i reduce the size from 1000001x1 to 1001x1 without any distortion in the current values

Respuesta aceptada

dbmn
dbmn el 28 de Mzo. de 2017
There are multiple possible solutions to your question (with different results), but all of them will fail the "without any distortion" requirement.
  • you can just take every 1000th element (bad if there is high frequency noise)
new_var = sim_var(1:1000:end);
  • do the same, but with a filter first (f.ex. moving average) - better for noise
% create moving average
sim_var2 = movmean(sim_var,1000);
% same as before
new_var2 = sim_var2(1:1000:end);
attached is a little example to show your the differences between the first two approaches
  • Interpolate the values in your postprocessing calculation using "interp1"
  • choose a different Stepsize for Simulation (100001 sounds like fixed step) to get to 1001 points
  1 comentario
Harinee Kannan
Harinee Kannan el 11 de Abr. de 2017
Editada: Harinee Kannan el 11 de Abr. de 2017
The method was useful but there is a heavy loss in data. Now am trying to make the process online so as the values from simulink comes out, I can process it without storing. Is there any procedure to make the simulation online?

Iniciar sesión para comentar.

Más respuestas (1)

ES
ES el 28 de Mzo. de 2017
Editada: ES el 28 de Mzo. de 2017
Resample the data.
For example,
>> a = zeros(1000001,1); % Some data
>> b = a(1:1000:end); % Take every 1000th data
>> size(b)
ans =
1001 1

Community Treasure Hunt

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

Start Hunting!

Translated by