Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal...
Transcript of Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal...
![Page 1: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/1.jpg)
1© 2015 The MathWorks, Inc.
Signal Processing Master Class
Graham Reith
![Page 2: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/2.jpg)
2
Session Outline
Offline
signal
processing with
MATLAB
Streaming
signal
processing with
MATLAB
Deployed
signal
processing from
MATLAB
Functions,
Capabilities
Structure,
Performance
Prototyping,
Implementation
C
![Page 3: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/3.jpg)
3
Session Outline
Offline
signal
processing with
MATLAB
Streaming
signal
processing with
MATLAB
Deployed
signal
processing from
MATLAB
Functions,
Capabilities
Structure,
Performance
Prototyping,
Implementation
C
![Page 4: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/4.jpg)
4
Spectral Analysis
Determining the Frequency Content of a Signal
– Usually analysis based on the Fast Fourier Transform (FFT)
– Trade-offs to manage: frequency resolution vs sidelobe attenuation
![Page 5: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/5.jpg)
5
Introducing the Signal Analyzer App
Spectral analysis of signals
Time domain panning
Enhanced command line interface
allows specifying input signals and
sample rates
Analyze signals in time and
frequency and navigate through
the signals using a panner.
![Page 6: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/6.jpg)
6
Spectrum Controls
Control spectral leakage (Kaiser window shape factor)
Read resolution bandwidth values for the current
spectral estimates
![Page 7: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/7.jpg)
7
Spectrum Scope
dsp.SpectrumAnalyzer
![Page 8: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/8.jpg)
8
Scope Improvements
Spectral Mask in Spectrum Analyzer
– Compare a spectrum to a mask, e.g. to verify
compliance with communication standards
or design requirements
– Use in MATLAB or Simulink
Now supported by MATLAB Compiler: – dsp.TimeScope
– dsp.SpectrumAnalyzer
– dsp.ArrayPlot
Array Plot: Custom X-axis data
– Visualize arbitrarily-spaced data
Time Scope: Programmatic legend strings and autoscaling
![Page 9: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/9.jpg)
9
Channelizer and Filter-bank Spectral Analysis
Analyze and synthesize narrow subbands of a
broadband signal using a polyphase FFT filter bank
Analysis: dsp.Channelizer
Synthesis: dsp.ChannelSynthesizer
Efficient filter banks based on FFT
and a polyphase structure for filtering
Used for high-resolution spectral analysis:
– Achieve arbitrary inter-channel separation
Applications in 5G communications – beyond OFDM
Use as method of dsp.SpectrumEstimator
![Page 10: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/10.jpg)
10
Comparison: Channelizer for Spectral Analysis
![Page 11: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/11.jpg)
11
Analysing Vibration Data
Data from rotational machinery, captured using accelerometers
Typically fundamental frequencies and harmonics vary with RPM
![Page 12: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/12.jpg)
12
Order Spectrum and Order Tracking
Compute and display an order amplitude profile vs. RPM using ordertrack
Compute and display an average spectrum using orderspectrum
Analyze the amplitude and spectrum of vibration signal orders
>> ordertrack(x,Fs,rpm,orderlist)
>> ordertrack(map,order,rpm,…)
>> orderspectrum(x,Fs,rpm)
>> orderspectrum(map,order)
![Page 13: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/13.jpg)
13
Order Waveforms
Extract decoupled time-domain waveforms
for crossing (and non-crossing) orders
Vold-Kalman Filter
– Specify bandwidth and order
Compute waveforms by segments to
improve computation speed
Extract time-domain orders waveforms
>> orderlist=[0.052 0.066 0.264])
>> orderwaveform(x,fs,rpm,orderlist)
![Page 14: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/14.jpg)
14
Synchrosqueezing Transforms
>> sst = fsst(x,…)
Compute and display a compact time-frequency representation of modes using fsst
Extract time-frequency ridges (e.g. instantaneous frequency of each mode) using tfridge
Reconstruct the entire plane, a band of frequencies, or a time-frequency ridge using ifsst
High resolution time-frequency spectral analysis and waveform extraction
>> [f,idx] = tfridge(sst,…) >> y = ifsst(sst,[],idx)
![Page 15: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/15.jpg)
15
Finding a Signal via Similarity Search: findsignal
Compare real/complex vectors of arbitrary
dimensions
Popular distance metrics (Euclidean,
Squared Euclidean, Symmetric Kullback-
Liebler)
Convenient normalizations (Zero-mean, Unit
norm, average power) over an arbitrary
sample length for both data and signal
Time warping
Outlier robustness
Locate the best matching data to your signal
» data = exp(-((1:300)/100).^2).*cos(2*pi*(1:300)/100);
» signal = sin(2*pi*(1:100)/100);
» findsignal(data,signal)
![Page 16: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/16.jpg)
16
Session Outline
Offline
signal
processing with
MATLAB
Streaming
signal
processing with
MATLAB
Deployed
signal
processing from
MATLAB
Functions,
Capabilities
Structure,
Performance
Prototyping,
Implementation
C
![Page 17: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/17.jpg)
17
Offline Processing vs Streaming Processing
2 Entry Points for describing Signal Processing operations in MATLAB:
Data analysis
Algorithm exploration
System simulation
Efficient implementation
Function
Initialize
Process
![Page 18: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/18.jpg)
18
fs
fRF
fs Sampling frequency (up to ~2.8MHz)
fRF RF Centre Frequency (20MHz to ~1.8GHz)
+ Tuner gain parameters
Frequency correction parameters
Example: RTL-SDR USB RF Receiver
![Page 19: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/19.jpg)
19
ADS-B Receiver
![Page 20: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/20.jpg)
20
Execution Engine from R2015b
Efficient Coding Constructs
Parallel Computing– Desktop
– Computer Clusters
– GPU Acceleration
MATLAB to C– MATLAB Coder
Accelerating your Simulations
C
![Page 21: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/21.jpg)
21
Multithreaded Acceleration via Unfolding
Generate a multi-threaded MEX file from a MATLAB function that operates on streamed signals with dspunfold
Acceleration workflow based on code generation
– Requires MATLAB Coder
Application to DSP
– Distribute subsequent frames to different cores at the
expense of latency
Support for custom processing algorithms
![Page 22: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/22.jpg)
22
Creating Parallelism by Unfolding
CPU1
CPU2
CPU3
Alg Instance 1
Frame T-2
Alg Instance 2
Frame T-1
Alg Instance 3
Frame T-0
One long time series…
Normal: Execute one instance of one algorithm on the dataset
Unfolded: Replicate the algorithm to run multiple instances (copies)
Each instance operates on a different frame of the dataset
Each instance executes on a different thread (core)
Frame
T-2
Frame
T-1
Frame
T-0……
![Page 23: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/23.jpg)
23
Stateless Algorithms
F = 50, U=4
U1
U2
U3
U4
time
...
1 50
Frame1
51 100
Frame2
101 150
Frame3
151 200
Frame4
201 250
Frame5
251 300
Frame6
301 350
Frame7
351 400
Frame8
1 50
Frame1
51 100
Frame2
101 150
Frame3
151 200
Frame4
201 250
Frame5
251 300
Frame6
301 350
Frame7
351 400
Frame8
CPU1
CPU2
CPU3
CPU4
Speed improvement = 𝑢𝑛𝑖𝑞𝑢𝑒 𝑠𝑎𝑚𝑝𝑙𝑒𝑠 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑒𝑑
𝑠𝑎𝑚𝑝𝑙𝑒𝑠 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑒𝑑 𝑝𝑒𝑟 𝑡ℎ𝑟𝑒𝑎𝑑=
400
100= 4𝑥
Step 1 Step 2
F = Frame size – minimum number of samples given to algorithm at once
U = Threads – assume each thread maps to a core
![Page 24: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/24.jpg)
24
U1
U2
U3
U4
1 50
Frame1
51 100
Frame2
101 150
Frame3
151 200
Frame4
201 250
Frame5
251 300
Frame6
301 350
Frame7
351 400
Frame8
201 250
Frame5
200191
51 100
Frame2
5041
101 150
Frame3
10091
151 200
Frame4
150141
251 300
Frame6
250241
301 350
Frame7
300291
351 400
Frame8
350341
F=50, S=10, U=4
time
Step 2
Efficiency =𝑢𝑛𝑖𝑞𝑢𝑒 𝑠𝑎𝑚𝑝𝑙𝑒𝑠 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑒𝑑
𝑡𝑜𝑡𝑎𝑙 𝑠𝑎𝑚𝑝𝑙𝑒𝑠 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑒𝑑=
400
480= 83%
Speedup = 𝑢𝑛𝑖𝑞𝑢𝑒 𝑠𝑎𝑚𝑝𝑙𝑒𝑠 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑒𝑑
𝑠𝑎𝑚𝑝𝑙𝑒𝑠 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑒𝑑 𝑝𝑒𝑟 𝑡ℎ𝑟𝑒𝑎𝑑=
400
120= 3.3𝑥
501
Frame10CPU1
CPU2
CPU3
CPU4
Step 1
...
Algorithms with State
![Page 25: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/25.jpg)
25
Session Outline
Offline
signal
processing with
MATLAB
Streaming
signal
processing with
MATLAB
Deployed
signal
processing from
MATLAB
Functions,
Capabilities
Structure,
Performance
Prototyping,
Implementation
C
![Page 26: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/26.jpg)
26
From MATLAB algorithms to real-time code
Experiment with algorithm in MATLAB
Architect/review/optimize MATLAB code
Generate real-time source C/C++ code
Verify/validate generated code
Optimize generated code
C
![Page 27: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/27.jpg)
27
Raspberry Pi with RTL-SDR
From R2015b: Using the Raspberry Pi with the RTL-SDR receiver
Deploy signal processing algorithms directly to the ARM processor on the
Raspberry Pi, and stream in data from the RTL-SDR receiver
Output audio, or send data to ThingSpeak, etc
![Page 28: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/28.jpg)
28
Session Outline
Offline
signal
processing with
MATLAB
Streaming
signal
processing with
MATLAB
Deployed
signal
processing from
MATLAB
Functions,
Capabilities
Structure,
Performance
Prototyping,
Implementation
C
![Page 29: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/29.jpg)
29
Tools used in this Presentation
MATLAB
Signal Processing Toolbox
DSP System Toolbox
Communications System Toolbox
– Support Package for RTL-SDR
Simulink
– Support Package for Raspberry Pi
MATLAB Coder
![Page 30: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/30.jpg)
30
Other Sessions at MATLAB EXPO Today
Application Track 1:
15:45-16:15
16:15-17:00
![Page 31: Signal Processing Master Class...MATLAB Streaming signal processing with MATLAB Deployed signal processing from MATLAB Functions, Capabilities Structure, Performance Prototyping, Implementation](https://reader030.fdocuments.in/reader030/viewer/2022033119/5eb4472e4dd7e9389e1e1ab4/html5/thumbnails/31.jpg)
31
Demo Stations at MATLAB EXPO Today
Real-Time Audio Processing with MATLAB:
Automatic VST Plugin Generation
Designing, Prototyping, and Testing
Video Algorithms for FPGA and SoC
Using MATLAB to Explore the
Internet of Things
Wireless Communication System Design
Using MATLAB and Simulink