MATLAB Answers

Importing timeseries with different sampling rate into simulink loses data?

16 views (last 30 days)
Javier Cuadros
Javier Cuadros on 28 Aug 2020
Edited: Stefanie Schwarz on 8 Sep 2020
Hello all,
I have been seeing some spooky effect in my simulations, I could have traced it to what I think is the importing of the time series into simulink. Let's me show what I do,
  • I create a 802.11p signal with wlan tool box
cfgNHT = wlanNonHTConfig;
cfgNHT.ChannelBandwidth = 'CBW10';
cfgNHT.PSDULength = psduLen;
cfgNHT.MCS = mcs;
%% Packet parameters
% Create random data; PSDULength is in bytes
savedState = rng(0); % Set random state
data = randi([0 1],cfgNHT.PSDULength*8*numPackets,1);
% Generate a multi-packet waveform
waveForm80211p = wlanWaveformGenerator(data,cfgNHT, 'NumPackets',100,'IdleTime',3.6e-3/10);
fs = wlanSampleRate(cfgNHT);
  • Convert that signal into a timeseries to import into simulink
s = timeseries(txWaveform,1:length(txWaveform));
s.Time = s.Time/fs;
  • Import s signal into simulink via a From Workspace block using sample time 1/fs
  • Change the sample rate of s within simulink to 1/(64*fs) using a RateTransition block since my model runs with that simulation step
Something as shown below
  • Run the simulation
Then what I observe is that for certain 802.11p signals, its SFT are not looking as they supposed to look like, they look like this ( yellow signal)
whereas they should looke like this
THe above two scrreenshots are coming from the same simulation as shown below
So it seems that sometimes the timeseries s is not properly either imported or re-sampled by simulink, since if I plot out.s_simulink I get this
Any ideas why is this happening? Is a bug in Simulink when importing the timeseries to an different sampling rate model?

Answers (1)

Stefanie Schwarz
Stefanie Schwarz on 8 Sep 2020
Edited: Stefanie Schwarz on 8 Sep 2020
This is probably the result of the Interpolation settings in your From Workspace block. Please see the following MATLAB Answers post regarding why it looks like data is being lost when you disble interpolation:

Community Treasure Hunt

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

Start Hunting!