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

'Time (Sec) ' 'Amlitude' 'Sinc Function'

The document contains information about digital signal processing concepts including the sinc function, sampling of continuous time signals, the Nyquist sampling theorem, aliasing effects in the time and frequency domains, and impulse and frequency responses of discrete time linear and time-invariant systems. Plots and equations are provided to illustrate these concepts.

Uploaded by

siddani12
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

'Time (Sec) ' 'Amlitude' 'Sinc Function'

The document contains information about digital signal processing concepts including the sinc function, sampling of continuous time signals, the Nyquist sampling theorem, aliasing effects in the time and frequency domains, and impulse and frequency responses of discrete time linear and time-invariant systems. Plots and equations are provided to illustrate these concepts.

Uploaded by

siddani12
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 12

Sinc Function:

t = linspace(-5,5,50);
y=sinc(t);
plot(t,y);
pause
stem(t,y);
xlabel('Time (sec)');ylabel('Amlitude');title('Sinc Function')

0.8

0.6

0.4

0.2

-0.2

-0.4
-5 -4 -3 -2 -1 0 1 2 3 4 5

Sinc Function
1

0.8

0.6
A m lit u d e

0.4

0.2

-0.2

-0.4
-5 -4 -3 -2 -1 0 1 2 3 4 5
Time (sec)
Sampling of a Sinusoidal Signal:
t= 0:0.0005:1
F = 13
xa = cos(2*pi*F*t);
figure; subplot(211); plot(t,xa);grid;
xlabel('Time, Sec'); ylabel('Amplitude');
title('Continuous-time signal x_{a}(t)');
axis([0 1 -1.2 1.2]);
T= 0.1; n = 0:T:1;
xs = cos(2*pi*F*n);
k = 0:length(n)-1;
subplot(212);stem(k,xs);grid;
xlabel('Time index n'); ylabel('Amplitude');title('Discrete-time signal
x[n]');
axis([0 length(n)-1 -1.2 1.2]);

Continuous-time signal x a(t)

0.5
Amplitude

-0.5

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time, Sec
Discrete-time signal x[n]
1

0.5
Amplitude

-0.5

-1
0 1 2 3 4 5 6 7 8 9 10
Time index n
Verification OF Nyquist Sampling Theorem – Taking User Input
f=input('Give signal freq in Hz, f = ');
t = 0:0.005:1;
omega = 2*pi*f;
xa= cos(omega*t);
subplot(221);plot(t,xa);grid;
xlabel('time-sec');ylabel('Amplitude');
title('cont-time signal x_a(t)');
axis([ 0 1 -1.2 1.2])
fs1= input('enter 1st sampling freq, less then twice the max signal frequency
in Hz, fs1 = ');
T1= 1/fs1;
n = 0:T1:1;
w= 2*pi*f;
xs1=cos(w*n);
k = 0:length(n)-1;
subplot(222);stem(k,xs1);grid;
xlabel('time index n');ylabel('Amp');title('Discrete time signal xs1 with
Fs<2Fmax');
axis([0 (length(n)-1) -1.2 1.2])
fs2 =input('Enter 2nd sampling freq, equal to twice the max signal frequency
in Hz, fs2 = ');
T2=1/fs2;
n=0:T2:1;
w=2*pi*f;
xs2=cos(w*n);
k = 0:length(n)-1;
subplot(223);stem(k,xs2);grid;
xlabel('time index n');ylabel('Amp');title('Discrete time signal xs2 with
Fs=2Fmax');
axis([0 (length(n)-1) -1.2 1.2])
fs3 =input('Enter 3rd sampling freq, greater than twice the max signal
frequency in Hz, fs3 = ');
T3=1/fs3;
n=0:T3:1;
w=2*pi*f;
xs3=cos(w*n);
k = 0:length(n)-1;
subplot(224);stem(k,xs3);grid;
xlabel('time index n');ylabel('Amp');title('Discrete time signal xs2 with
Fs>2Fmax');
axis([0 (length(n)-1) -1.2 1.2])
cont-time signal x a(t) Discrete time signal xs1 with Fs<2Fmax
1 1

0.5 0.5
Amplitude

Amp
0 0

-0.5 -0.5

-1 -1
0 0.5 1 0 2 4 6
time-sec time index n
Discrete time signal xs2 with Fs=2Fmax Discrete time signal xs2 with Fs>2Fmax
1 1

0.5 0.5
Amp

Amp
0 0

-0.5 -0.5

-1 -1
0 5 10 0 10 20 30 40 50
time index n time index n
Illustration Of Aliasing Effect In Time Domain

WITH ALIASING

f= 13;
T= 1/(13*1.5);
n= (0:T:1)';
xs=cos(2*pi*f*n);
t = [-.5:.004:1.5]';
ya = sinc((1/T)*t(:,ones(size(n)))- (1/T)*n(:,ones(size(t)))' )*xs;
figure; subplot(211);
plot(n,xs,'o',t,ya);
grid;
xlabel('Time Sec');ylabel('Amplitude');
title('Reconstructed continuous-time signal y_{a}(t)');
axis([0 1 -1.2 1.2]);
subplot(212);
t = 0:0.0005:1;
xa=cos(2*pi*f*t);
plot(t,xa);grid;
xlabel ('Time Sec');ylabel('Amplitude');
title ('Original Continuous time signal x{a}(t)');
axis ([0 1 -1.2 1.2]);

Reconstructed continuous-time signal y a(t)

0.5
Amplitude

-0.5

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time Sec
Original Continuous time signal xa(t)
1

0.5
Amplitude

-0.5

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time Sec
WITHOUT ALIASING
f= 13;
T= 1/(13*2);
n= (0:T:1)';
xs=cos(2*pi*f*n);
t = [-.5:.004:1.5]';
ya = sinc((1/T)*t(:,ones(size(n)))- (1/T)*n(:,ones(size(t)))' )*xs;
figure; subplot(211);
plot(n,xs,'o',t,ya);
grid;
xlabel('Time Sec');ylabel('Amplitude');
title('Reconstructed continuous-time signal y_{a}(t)');
axis([0 1 -1.2 1.2]);
subplot(212);
t = 0:0.0005:1;
xa=cos(2*pi*f*t);
plot(t,xa);grid;
xlabel ('Time Sec');ylabel('Amplitude');
title ('Original Continuous time signal x{a}(t)');
axis ([0 1 -1.2 1.2]);

Reconstructed continuous-time signal y a(t)

0.5
Amplitude

-0.5

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time Sec
Original Continuous time signal xa(t)
1

0.5
Amplitude

-0.5

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time Sec
Illustration of Aliasing Effect in Frequency Domain

Sampling a Non-bandlimited signal


t = 0:0.006:10;
xa=2*t.*exp(-t);
figure;
subplot(221);plot(t,xa);grid;
xlabel('Time Sec');ylabel('Amplitude');
title('Continuous time signal x_{a}(t)');
subplot(222);
fa=0:0.001:10;
wa=2*pi*fa;
Xa=2./((1-wa.^2)+j*2*wa);
plot(fa(1:1500),abs(Xa(1:1500)) );grid;
xlabel('Frequency Hz');ylabel('Amplitude');
title('Xa Frequency Spectrum');
subplot(223);
T=0.5;
n=0:T:10;
xs=2*n.*exp(-n);
k = 0:length(n)-1;
stem(k,xs);grid;
xlabel('Time Index n');ylabel('Amplitude');
title('Discrete time signal x[n]');
subplot(224);
wd=0:pi/255:pi;
Xs=freqz(xs,1,wd);
plot(wd/2*T*pi),T*abs(Xs);grid;
xlabel('Frequency Hz');ylabel('Amplitude');
title('Xs Frequency Spectrum');
Continuous time signal x a(t) Xa Frequency Spectrum
0.8 2

0.6 1.5
Amplitude

Amplitude
0.4 1

0.2 0.5

0 0
0 5 10 0 0.5 1 1.5
Time Sec Frequency Hz
Discrete time signal x[n] Xs Frequency Spectrum
0.8 3

0.6
2
Amplitude

Amplitude
0.4
1
0.2

0 0
0 5 10 15 20 0 100 200 300
Time Index n Frequency Hz
Impulse, Step and Frequency Response of a DT LTI FIR System

a = [ 1 0 -0.268]
b = [0.634 0 0.634]
x = [1 zeros(1,31)];
y = filter(b,a,x);
y = stem(y); grid;

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 5 10 15 20 25 30 35
figure;impz(b,a);grid;

Impulse Response
0.9

0.8

0.7

0.6
Amplitude

0.5

0.4

0.3

0.2

0.1

0
0 2 4 6 8 10 12 14
n (samples)

fvtool(b,a);
Magnitude Response (dB)
10

-10

-20
Magnitude (dB)

-30

-40

-50

-60

-70
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
Normalized Frequency (  rad/sample)
Impulse Response
0.9

0.8

0.7

0.6

0.5
Amplitude

0.4

0.3

0.2

0.1

0
0 2 4 6 8 10 12 14
Samples

Phase Response
100

80

60

40
Phase (degrees)

20

-20

-40

-60

-80

-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
Normalized Frequency (  rad/sample)
Step Response
1.8

1.6

1.4

1.2

1
Amplitude

0.8

0.6

0.4

0.2

0
0 2 4 6 8 10 12 14
Samples

Pole/Zero Plot
1

0.8

0.6

0.4
Imaginary Part

0.2

-0.2

-0.4

-0.6

-0.8

-1

-1.5 -1 -0.5 0 0.5 1 1.5


Real Part

You might also like