Created by Dr. V. R. Ratnaparkhe
Signals & SystemsVirtual Laboratory
Experiment 10 · Signals & Systems Lab

Signal Transforms in Simulink

Build block diagrams with transfer-function, discrete-filter and spectrum blocks, then simulate them live.

Transfer FcnDiscrete FilterSpectrumCO 1-4

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

BlockLibraryTransform domain
Step / Pulse / Sine Wave / ChirpSourcestime
Transfer FcnContinuousLaplace H(s)
Zero-Order HoldDiscretesampler (period Ts)
Discrete Transfer FcnDiscreteZ, H(z)
Spectrum Analyzer / FFTDSP System ToolboxFourier
Scope, MuxSinks, 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 theoremy(∞) = lims→0 s·Y(s). For a step of size A: y(∞) = A·H(0) = A·K.
Second-order overshootMp = e^{−ζπ/√(1−ζ²)} × 100%, peak time tp = π/(ωn√(1−ζ²))
First-orderReaches 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.
x(t)time H(s)Laplace H(z)Z ℒ Tustin / c2d s = j2πf → Fourier H(f)

In MATLAB / Simulink

  1. Open a new Simulink model and place: Step → Transfer Fcn → Scope.
  2. Branch the source to a Zero-Order Hold (Ts) → Discrete Transfer Fcn → the same Scope (through a Mux).
  3. Put the H(z) coefficients from c2d(tf(num,den),Ts,'tustin') into the Discrete Transfer Fcn.
  4. Add a Spectrum Analyzer (or To Workspace + fft) to the output.
  5. Set the solver to fixed-step ode4, step 1e-3, and the stop time to 10 s. Run.

In this virtual lab

  1. Choose the system type and its parameters (K, τ or ζ, ωₙ).
  2. Choose the input and press ▶ Run simulation. The signal flow animates and the Scope fills.
  3. Compare the continuous (green) and discrete (pink stairs) outputs. Increase Ts and watch the error grow.
  4. Check the final value against the FVT, and the overshoot against the formula, in the readouts.
  5. Look at the spectrum: at the sine frequency, the output peak equals the input peak × |H(j2πf)|.
  6. Record each run in Observations.

Pre-lab diagnostic

Block parameters

AudioLive mode: pitch follows the sine frequency (scaled to audio), and loudness is |H(j2πf)|. Sweep the frequency slider through ωₙ/2π to hear the resonance peak. Lower ζ makes it louder.
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);