Aim
Extract the even and odd parts of five different signals and compare them with the theoretical results.
Objectives
- Define even and odd symmetry for discrete signals.
- Compute xe[n] and xo[n] from x[n] and x[−n].
- Check that x = xe + xo and that Ex = Ee + Eo.
- Compare computed parts with closed-form answers for 5 standard signals.
Definitions
Even: x[−n] = x[n] (mirror-symmetric about n = 0)
Odd: x[−n] = −x[n] (anti-symmetric; x[0] must be 0)
x_e[n] = ½ { x[n] + x[−n] }
x_o[n] = ½ { x[n] − x[−n] }
x[n] = x_e[n] + x_o[n]
Every signal can be split into one even part and one odd part, and the split is unique. The even and odd parts are orthogonal: Σ xe[n]·xo[n] = 0. So the energies simply add.
Animation: building the parts
x[n] (green) is mirrored to x[−n] (blue). Their half-sum gives xe and their half-difference gives xo.
Theoretical results for the five test signals
| # | x[n] | xe[n] | xo[n] |
|---|---|---|---|
| 1 | u[n] | ½ + ½δ[n] | ½·sgn[n] |
| 2 | aⁿu[n] | ½a|n| + ½δ[n] | ½·sgn[n]·a|n| |
| 3 | n·u[n] (ramp) | |n|/2 | n/2 |
| 4 | cos(ω₀n) + sin(ω₀n) | cos(ω₀n) | sin(ω₀n) |
| 5 | δ[n−2] + 2δ[n+1] | ½δ[n−2] + ½δ[n+2] + δ[n+1] + δ[n−1] | ½δ[n−2] − ½δ[n+2] + δ[n+1] − δ[n−1] |
sgn[n] = 1 for n > 0, 0 for n = 0, and −1 for n < 0.
- Choose Signal 1 in the Simulator. Use a symmetric index range (−N…N) so that x[−n] is defined everywhere.
- Press ▶ Animate decomposition to see the fold, the half-sum and the half-difference.
- Read the max |computed − theory| values for xe and xo. They should be 0.
- Repeat for signals 2–5. For signal 2, change a; for signal 4, change ω₀.
- Type your own sequence (Custom). Before you look, predict whether it is even, odd or neither.
- Record each signal. In "Observed" type the value of xe[1] you worked out by hand.
If your MATLAB index range is not symmetric, pad with zeros first. Otherwise
fliplr(x) does NOT give x[−n].Pre-lab diagnostic
Signal
x[n]
x[−n]
x_e[n] computed (●) vs theory (○)
x_o[n] computed (●) vs theory (○)
Check: x_e + x_o (●) on top of x[n] (○)
Comparison table
Analysis
Post-lab quiz
Self-evaluation
exp5_evenodd.m
%% Experiment 5: Even and odd parts of signals clc; clear; close all; n = -10:10; % symmetric range! X = { (n>=0), 0.8.^n.*(n>=0), n.*(n>=0), cos(pi*n/5)+sin(pi*n/5), (n==2)+2*(n==-1) }; names = {'u[n]','0.8^n u[n]','n u[n]','cos+sin','impulses'}; for k = 1:5 x = X{k}; xr = fliplr(x); % x[-n] xe = (x + xr)/2; xo = (x - xr)/2; figure('Name',names{k}); subplot(3,1,1); stem(n,x); title(['x[n] = ' names{k}]); subplot(3,1,2); stem(n,xe); title('even part'); subplot(3,1,3); stem(n,xo); title('odd part'); fprintf('%-10s max|x-(xe+xo)| = %g Ee+Eo-Ex = %g\n', names{k}, ... max(abs(x-(xe+xo))), sum(xe.^2)+sum(xo.^2)-sum(x.^2)); end