Вы находитесь на странице: 1из 10

INSTR F243: Signal & Systems

Instructor: Pawan k.Ajmera

MATLAB ASSIGNMENT

RAJ AARYAN(2017B4A80753P)

Due Friday, May 8, 2020


Contents

1 Question1 2

1.1 CODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2 IMAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Question 2 4

2.1 CODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 IMAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Question3 6

3.1 CODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.2 IMAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4 Question 4 8

4.1 CODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.2 IMAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

1
1 Question1

1.1 CODE

1
2 % Specification in problem: Amplitude= 2
3 % Duration= 2 second
4 % frequency = 753 Hertz
5 % Sampling frequency =20kHz
6 clc;
7 close all;
8 clear all;
9 fs = 20000; % Sampling frequency
10 t = 0:1/fs:2; % Duration
11 a = 2; % Amplitude
12 f = 753; % Frequency of signal
13 y = a*cos(2*pi*f*(t)); % Cosine signal
14 % Plot 1−
15 subplot(2,1,1);
16 plot(t,y);
17 axis([0 2/f −2 2]);
18 xlabel('Time (in sec)');
19 ylabel('Amplitude');
20 title('1(a) Cosine Signal − First two cycles');
21 % Delayed signal
22 y2 = a*cos(2*pi*f*(t−0.1));
23 % Plot 2
24 subplot(2,1,2);
25 plot(t,y2);
26 axis([0 2/f −2 2]);
27 xlabel('Time (in sec)');
28 ylabel('Amplitude');
29 title('1(b) Delayed Signal by 100msec − First two cycles');

2
1.2 IMAGE

1(a) Cosine Signal - First two cycles


2

1
Amplitude

-1

-2
0 0.0005 0.001 0.0015 0.002 0.0025
Time (in sec)

1(b) Delayed Signal by 100msec - First two cycles


2

1
Amplitude

-1

-2
0.1 0.1005 0.101 0.1015 0.102 0.1025
Time (in sec)

Figure 1: Caption

3
2 Question 2

2.1 CODE

1 % Specification required : a= 7(Maximum of 7,5 and 3)


2 close all;
3 clear all;
4 clc;
5
6 n1 = 1:1:5;
7 x = [1,1,1,1,1 ];
8 subplot (2, 2, 1);
9 stem (n1,x);
10 xlabel('Samples');
11 ylabel ('Ampltiude');
12 title ('x[n]');
13
14
15 n2 = −7:1:4 ;
16 h1 = [1 1 1 1 1 1 1 1 1 1 1 1 ];
17 subplot (2, 2, 2);
18 stem (n2 ,h1);
19 xlabel('Samples');
20 ylabel ('Ampltiude');
21 title ('h1[n]');
22
23
24 n3 = −6:1:9; %Sum of left sided limit and sum of right Sided Limits
25 y1 = conv(x,h1);
26 subplot (2, 2 ,3);
27 stem (n3,y1)
28 xlabel('Samples');
29 ylabel ('Ampltiude');
30 title ('x[n]*h1[n]');
31
32
33 n3 = −5:1:10; %Sum of left sided limit and sum of right Sided Limits
34 h2 = [1 ];
35 subplot (2, 2, 4);
36 y = conv(h2,y1);
37 stem(n3,y);
38 xlabel('Samples');
39 ylabel ('Ampltiude');
40 title ('Y[n]');

4
2.2 IMAGE

x[n] h1[n]
1 1

0.8 0.8
Ampltiude

Ampltiude
0.6 0.6

0.4 0.4

0.2 0.2

0 0
1 2 3 4 5 -8 -6 -4 -2 0 2 4
Samples Samples

x[n]*h1[n] Y[n]
5 5

4 4
Ampltiude

Ampltiude
3 3

2 2

1 1

0 0
-10 -5 0 5 10 -10 -5 0 5 10
Samples Samples

Figure 2: Caption

5
3 Question3

3.1 CODE

1 %
2 % Specification Mentioned : a=7 b=5 c=3
3
4 close all;
5 clear all;
6 clc;
7
8 num = [7 5 3]; % numerator of transfer function
9 den = [3 5 7]; % denominator of transfer function
10
11 H = tf(num,den) % to find zeros, poles and gain
12
13 pzmap(H); % to plot zeros and poles
14 grid on ;
15 [z,p]= tf2zp(num,den);
16 % stability will be there if all poles lies behind jw axis.

6
3.2 IMAGE

Figure 3: Caption

7
4 Question 4

4.1 CODE

1 close all;
2 clear all;
3 clc;
4
5
6 dur= 2; %Duration of plot is 2 second
7 Fs = 20000; % Sampling frequency is 20kHz
8 dur samples= 0:(1/ Fs):2 ;
9 freq1= 753;
10 freq2= 11753;
11 x = 2*[cos(2*pi*freq1* dur samples)+cos(2*pi*freq2* dur samples)];
12 fft x= fft(x,Fs);
13 frequency = [0:length(fft x)−1]* Fs/length(fft x);
14 plot(frequency,abs(fft x));
15 axis([0 10000 0 25000 ]);
16 xlabel('Frequency(Hz)');
17 ylabel ('Ampltiude');
18 title ('FFT −Magntitude Response');

8
4.2 IMAGE
FFT -Magntitude Response
25000

20000

15000
Ampltiude

10000

5000

0
0 2000 4000 6000 8000 10000
Frequency(Hz)

Figure 4: Caption

COMMENT

Вам также может понравиться