Importing timeseries with different sampling rate into simulink loses data?
4 ビュー (過去 30 日間)
古いコメントを表示
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352883/image.png)
- 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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352886/image.png)
whereas they should looke like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352889/image.png)
THe above two scrreenshots are coming from the same simulation as shown below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352892/image.png)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352895/image.png)
Any ideas why is this happening? Is a bug in Simulink when importing the timeseries to an different sampling rate model?
0 件のコメント
回答 (1 件)
Stefanie Schwarz
2020 年 9 月 8 日
編集済み: Stefanie Schwarz
2020 年 9 月 8 日
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:
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!