Code covered by the BSD License  

Highlights from
MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".

image thumbnail

MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".

by

 

29 Oct 2012 (Updated )

These files are the MatLab solutions of exercises contained in the above DSP lab textbook.

ex214.m
% Exercise 2.1.4. Time Axis Alteration.

clc; clear; close all;
%% a. 

n = 0:4;
x = (3/4).^n;

figure('Name','Exercise 2.1.4. Time Axis Alteration');
subplot(2,1,1);
stem(n,x);
hold on;

stem(-n,x,'r*');
stem(-7-n,x,'g*');
stem(-n+15,x,'c*');
grid on;
title('x[n] (blue), x[-n] (red), x[-7-n] (green), x[-n+15] (cyan)');
xlabel('Sample n');

%% b.
x1 = downsample(x,2);
n1 = 0:length(x1)-1;
subplot(2,1,2);

stem(n1,x1,'b*');
grid on;
hold on;

stem(5-n1,x1,'g*');
title('x[2*n] (blue), x[5-2*n] (green)');
xlabel('Sample n');

Contact us