Aim
Implement signal transforms using Simulink: Laplace-domain systems (Transfer Fcn), Z-domain systems (Discrete Transfer Fcn with Zero-Order Hold), and the Fourier transform (FFT / Spectrum Analyzer).
Objectives
- Model a continuous LTI system as H(s) in a Transfer Fcn block and simulate its step, impulse and sine responses.
- Discretise H(s) to H(z) with the bilinear (Tustin) method and compare the continuous and discrete outputs.
- Use an FFT block to view the spectra of the input and output, and relate them through H(j2πf).
- Check the steady-state value against the final value theorem and the overshoot against the formula.
Simulink blocks used
| Block | Library | Transform domain |
|---|---|---|
| Step / Pulse / Sine Wave / Chirp | Sources | time |
| Transfer Fcn | Continuous | Laplace H(s) |
| Zero-Order Hold | Discrete | sampler (period Ts) |
| Discrete Transfer Fcn | Discrete | Z, H(z) |
| Spectrum Analyzer / FFT | DSP System Toolbox | Fourier |
| Scope, Mux | Sinks, Signal Routing | — |
One system, three views
Laplace: Y(s) = H(s)·X(s) H(s) = K/(τs+1) or Kωn²/(s²+2ζωn s+ωn²)
Fourier: Y(f) = H(j2πf)·X(f) (s → j2πf on the jω axis)
Z (Tustin): s ≈ (2/Ts)·(1 − z⁻¹)/(1 + z⁻¹) → H(z), y[n] = Σbₖx[n−k] − Σaₖy[n−k]
Useful results
| Final value theorem | y(∞) = lims→0 s·Y(s). For a step of size A: y(∞) = A·H(0) = A·K. |
| Second-order overshoot | Mp = e^{−ζπ/√(1−ζ²)} × 100%, peak time tp = π/(ωn√(1−ζ²)) |
| First-order | Reaches 63.2% of the final value at t = τ; settles to 2% at about 4τ. |
| Pole mapping (Tustin) | z = (1 + sTs/2)/(1 − sTs/2). The left half-plane maps to the inside of the unit circle, so stability is kept. |
In MATLAB / Simulink
- Open a new Simulink model and place: Step → Transfer Fcn → Scope.
- Branch the source to a Zero-Order Hold (Ts) → Discrete Transfer Fcn → the same Scope (through a Mux).
- Put the H(z) coefficients from
c2d(tf(num,den),Ts,'tustin')into the Discrete Transfer Fcn. - Add a Spectrum Analyzer (or To Workspace +
fft) to the output. - Set the solver to fixed-step
ode4, step 1e-3, and the stop time to 10 s. Run.
In this virtual lab
- Choose the system type and its parameters (K, τ or ζ, ωₙ).
- Choose the input and press ▶ Run simulation. The signal flow animates and the Scope fills.
- Compare the continuous (green) and discrete (pink stairs) outputs. Increase Ts and watch the error grow.
- Check the final value against the FVT, and the overshoot against the formula, in the readouts.
- Look at the spectrum: at the sine frequency, the output peak equals the input peak × |H(j2πf)|.
- Record each run in Observations.
Pre-lab diagnostic
Block parameters
Scope — input (blue), continuous H(s) output (green), discrete H(z) output (pink)
Spectrum Analyzer — |X(f)| (blue), |Y(f)| (green)
Frequency response |H(j2πf)| (green) vs |H(e^{j2πfTs})| (pink)
s-plane poles
z-plane poles (Tustin)
Simulation runs
Type the final value you read from the Scope (hover over the trace). It is compared with the final value theorem.
Second-order overshoot
Analysis
Post-lab quiz
Self-evaluation
exp10_simulink_transforms.m
%% Experiment 10: Signal transforms with Simulink (build model by script) clc; clear; close all; K = 1; wn = 3; zeta = 0.3; Ts = 0.1; num = K*wn^2; den = [1 2*zeta*wn wn^2]; Hs = tf(num,den) % Laplace domain Hz = c2d(Hs,Ts,'tustin') % Z domain [bz,az] = tfdata(Hz,'v'); mdl = 'exp10_model'; new_system(mdl); open_system(mdl); add_block('simulink/Sources/Step',[mdl '/Step']); add_block('simulink/Continuous/Transfer Fcn',[mdl '/H(s)'],'Numerator',mat2str(num),'Denominator',mat2str(den)); add_block('simulink/Discrete/Zero-Order Hold',[mdl '/ZOH'],'SampleTime',num2str(Ts)); add_block('simulink/Discrete/Discrete Transfer Fcn',[mdl '/H(z)'],'Numerator',mat2str(bz),'Denominator',mat2str(az),'SampleTime',num2str(Ts)); add_block('simulink/Signal Routing/Mux',[mdl '/Mux'],'Inputs','3'); add_block('simulink/Sinks/To Workspace',[mdl '/out'],'VariableName','y','SaveFormat','Array'); add_line(mdl,'Step/1','H(s)/1'); add_line(mdl,'Step/1','ZOH/1'); add_line(mdl,'ZOH/1','H(z)/1'); add_line(mdl,'Step/1','Mux/1'); add_line(mdl,'H(s)/1','Mux/2'); add_line(mdl,'H(z)/1','Mux/3'); add_line(mdl,'Mux/1','out/1'); set_param(mdl,'Solver','ode4','FixedStep','1e-3','StopTime','10'); so = sim(mdl); y = so.y; t = (0:size(y,1)-1)*1e-3; plot(t,y); legend('input','H(s)','H(z)'); grid on; % Fourier view: spectrum of the output Y = fft(y(:,2)); f = (0:length(Y)-1)/(length(Y)*1e-3); figure; plot(f(1:500),abs(Y(1:500))); title('|Y(f)|'); fprintf('FVT: y(inf) = K = %g, simulated = %g\n', dcgain(Hs), y(end,2)); step(Hs, Hz); bode(Hs, Hz); pzmap(Hs); figure; pzmap(Hz);