Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 35

ME5306-5536 Racing Team

Management and Vehicle Testing

Signal Integration and


Filtering with Simulink
Integration

• Consider the signal y and the independent variable t (e.g. time)

• Integrate y with respect to the independent variable t

dx
(t )  y (t ) 
dt
t
x(t )  x(t 0 )    y ( )  d
t0

• Calculate x(t) for the whole range of t

• e.g. Calculate yaw angle from yaw rate, distance from speed etc.
Integration with Simulink

• In the command
window type:
simulink
Simulink button
• or click the
simulink button
Integration with Simulink

• Start new Simulink


model (.mdl)

New model
Integration with Simulink

• Start new Simulink


model (.mdl)

New model
Integration with Simulink

• drag and drop the “From


Workspace” block from
the simulink library
(Simulink/Sources) to the
Simulink model

• Same for: Simulink/Sinks,


“To Workspace” block

• Same for:
Simulink/Continuous,
“Integrator” block
Integration with Simulink

• Connect the blocks as


shown

• Add a “Scope”
(Simulink/Sinks) as
necessary
Integration with Simulink

• Create t, y variables

• run “tutorial_data.m”
Integration with Simulink

• Double click on “From


Workspace” block
Integration with Simulink

• Provide independent
variable and signal to be
integrated [t y]

• Need column vectors

• Use transpose (‘) if


necessary
Integration with Simulink

• Double click on
“Integrator” block
Integration with Simulink

• Provide initial condition for


the integrated variable
Integration with Simulink

• Double click on “To


Workspace” block
Integration with Simulink

• Provide name for the


integrated variable

• Make sure the variable is


in array format
Integration with Simulink

• Simulink simulation time is


a separate variable

• Adjust simulink time to be


the same as the data time

• Go to Simulation,
Configuration parameters
Integration with Simulink
Integration with Simulink

• Run Simulink simulation


Filtering

• Laplace Transform of a function of time f(t)



L[ f (t )]  F ( s)   f (t )e  st dt
0

• Transfer function of an input-output system

u(t) y(t) L( y (t )) Y ( s )
H(s) H (s)  
L(u (t )) U ( s)
Filtering

• In a linear time-invariant system, the input frequency does not


change

• Only the amplitude and the phase angle of the sinusoid is


changed by the system

Y
• Gain G ( ) 
U

• Phase angle  ( )  arg(Y )  arg(U )


Filtering

• e.g. An integrator has a gain dependent on the input frequency


and a constant phase angle of -90deg.
Filtering

• Gain is typically measured in decibels (dB)

GdB ( )  20 log10 G( )


Filtering

• Filtering in signal processing is applied to suppress some aspects


of the signal.

• Remove some frequencies and not others in order to suppress


interfering signals and reduce background noise.

• Low-pass, High-pass, Band Pass

• Butterworth, Chebyshev, Bessel etc.


Filtering
• Bode plot of 1st order Butterworth filter (en.wikipedia.org)
Filtering with Simulink
• Open new Simulink model

• drag and drop the “From


Workspace” block from the
simulink library
(Simulink/Sources) to the
Simulink model

• Same for: Simulink/Sinks, “To


Workspace” block

• Same for: Signal Processing


Blockset/Filter Designs, “Analog
Filter Design” block
Filtering with Simulink

• Connect the blocks as


shown

• Add a “Scope”
(Simulink/Sinks) as
necessary
Filtering with Simulink

• Create t, y variables

• run “tutorial_data.m”
Filtering with Simulink

• Double click on “From


Workspace” block
Filtering with Simulink

• Provide independent
variable and signal to be
filtered [t y_combined]

• Need column vectors

• Use transpose (‘) if


necessary
Filtering with Simulink

• Double click on “Analog


Filter Design” block
Filtering with Simulink

• Adjust filter settings


Filtering with Simulink

• Double click on “To


Workspace” block
Filtering with Simulink

• Provide name for the


filtered variable

• Make sure the variable is


in array format
Filtering with Simulink

• Simulink simulation time is


a separate variable

• Adjust simulink time to be


the same as the data time

• Go to Simulation,
Configuration parameters
Filtering with Simulink
Filtering with Simulink

• Run Simulink simulation

You might also like