Thursday, 28 March 2019

Matlab DSP with Unit Sample and Unit Step Signal

28/3/2019 Digital Signal Processing Matlab

Seriously i have an assignment tomorrow but here I am doing this signal stuff. Like wtf Life.

Unit Sample and Unit Step Signals are the fundamentals of Signals Processing. Its the first thing you learn before you hit Cyclic Spectroscopy.

How do we generate this?

%Lab 1
%Generation of Unit Sample Sequence
clf;

%Begin
vectorLength = -10:20;
vectorLength2 = -10:7;
vectorLength3 = 1:20;
vectorLength4 = 1:7;

M = 13; %Delayed by M Samples
N = 20;

u = [zeros(1,10) 1 zeros(1,20)];
ud = [zeros(1,M) 1 zeros(1,N - M - 3)];

%Now do Unit Step
s = [ones(1,20)];

%Unit Step Depayed
sd = [ones(1,20 - M)];

%plot unit sample
figure(1)
stem(vectorLength, u)
xlabel('Time index n');
ylabel('Amplitude');
title('Unit Sample Sequence');
axis([-10 20 0 1.2]);

hold on

stem(vectorLength2, ud,'Color',[.204 .64 .100])

%Delayed Unit Sample
figure(2)
stem(vectorLength2, ud, 'Color',[.204 .64 .100])
xlabel('Time index n');
ylabel('Amplitude');
title('Unit Sample Delayed');
axis([-10 20 0 1.2]);

%Delayed Unit Sample
%Equivalence Principle
figure(3)
stem(vectorLength3, s)
xlabel('Time index n');
ylabel('Amplitude');
title('Unit Step Sequence');
axis([-10 20 0 1.2]);

%Delayed Unit Step
figure(4)
stem(vectorLength4, sd,  'Color',[.103 .62 .100])
xlabel('Time index n');
ylabel('Amplitude');
title('Unit Step Sequence Delayed');
axis([-10 20 0 1.2]);

No comments:

Post a Comment

Diaries of an Aspiring Astrophysicist (DAS Astro) Podcast

Diaries of an Aspiring Astrophysicist Episode 1: The last year has been weird Episode 2: Cosmic Collisions and Gravitational Wa...