Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
36 views

Digital Signals Processing Lab: Task 1 (A)

This document contains the work of a student named Zara Noor for their Digital Signal Processing lab. It includes code and results from three tasks: 1) Analyzing properties of a sine wave signal, 2) Shifting signal samples based on a shift value, and 3) Plotting a unit step function based on user-input values for the step change points. Key results reported include RMS, energy, and power calculations for the sine wave, as well as example plots of input signals and shifted signals.

Uploaded by

Zara Noor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Digital Signals Processing Lab: Task 1 (A)

This document contains the work of a student named Zara Noor for their Digital Signal Processing lab. It includes code and results from three tasks: 1) Analyzing properties of a sine wave signal, 2) Shifting signal samples based on a shift value, and 3) Plotting a unit step function based on user-input values for the step change points. Key results reported include RMS, energy, and power calculations for the sine wave, as well as example plots of input signals and shifted signals.

Uploaded by

Zara Noor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Zara Noor BSCE19013

Digital signals processing lab


Task 1
(a)

Code
n= 1:50;
s = sin(2*pi*n/50);
stem(n,s);
xlabel('n 1 : 50 ');
ylabel('s sin(2*pi*n/50)');
title('label x-axis and label y-axis');

Task 1(b)
1. max(s) = 0.998026
2. min(s) = -0.998026
3. mean(s) = -2.1552e-17
4. mean(s.^2) = 0.5000
5. rms(s) = 0.7071
6. Energy =25.0000
Task 1 (C)
1. Signal duration= 101
2. Energy= 50.0000
3. Average power= 0.4950
4. RMS Value= 0.7036
Task 2
Code
I. n=-3:6;
s =[0 0 0 2 0 3 -1 0 2 -3];
stem(n,s)
title('Input signal');

II. when nd is negative

n=-3:7;
signal =[0 0 0 2 0 3 -1 0 2 -3 0];
nd=-5;
if (nd<0)
n1=n-abs(nd);
subplot(2,1,1);
stem(n,signal);
title('signal before shifting');
subplot(2,1,2);
stem(n1,signal);
title('after shifiting signal ');
end
III. when nd is positive

n=-3:7;
signal =[0 0 0 2 0 3 -1 0 2 -3 0];
nd=5;
if (nd>=0)
n1=nd+n;
subplot(2,1,1);
stem(n,signal);
title('Input Signal');
subplot(2,1,2);
stem(n1,signal);
title('Shifted Signal');
end
Task (b)
ni=input('Enter ni:');
nh=input('Enter nh:');
t= (ni-5:0.01:nh+5);
unitstep = t<ni;
unitstep2 = t>nh;
z=-(unitstep2 + unitstep)+1;
plot(t,z);
title('Unit step');

You might also like