0% found this document useful (0 votes)
35 views

Post Lab Task Task 1:: 2 Sinusoidal Sequence

The document contains code for generating and manipulating sinusoidal sequences. It defines functions to add sequences, generates three sinusoidal sequences with different frequencies, and defines and plots two additional sequences that are derived from the first by adding, multiplying, and shifting elements.

Uploaded by

IAmAbdullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Post Lab Task Task 1:: 2 Sinusoidal Sequence

The document contains code for generating and manipulating sinusoidal sequences. It defines functions to add sequences, generates three sinusoidal sequences with different frequencies, and defines and plots two additional sequences that are derived from the first by adding, multiplying, and shifting elements.

Uploaded by

IAmAbdullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Waqar azeem

Usman Jalil

Sp10-Bet-086
Fa11-BET-105

Post Lab Task


Task 1:

Amplitude

Amplitude

Amplitude

n = 0:40;
f = 0.1;
phase = 0;
A = 1.5;
arg = 2*pi*f*n - phase;
x = A*cos(arg);
subplot(3,1,1)
stem(n,x);
axis([0 40 -2 2]);
f = 0.9;
arg = 2*pi*f*n - phase;
x = A*cos(arg);
subplot(3,1,2)
stem(n,x);
axis([0 40 -2 2]);
grid;
f = 1.1;
arg = 2*pi*f*n - phase;
x = A*cos(arg);
subplot(3,1,3)
stem(n,x);
axis([0 40 -2 2]);
grid;
Sinusoidal Sequence

2
0
-2

10

15

20
25
Time index n
Sinusoidal Sequence

30

35

40

10

15

20
25
Time index n
Sinusoidal Sequence

30

35

40

10

15

30

35

40

2
0
-2

2
0
-2

20
25
Time index n

Waqar azeem
Usman Jalil

Sp10-Bet-086
Fa11-BET-105

Coments:
Same output.
Task 2:
n = 0:50;
f = 0.08;
phase = 90;
A = 2.5;
arg = 2*pi*f*n - phase;
x = A*cos(arg);
stem(n,x);
axis([0 50 -5 5]);
grid;
TITLE('Sinusoidal Sequence');
Xlabel('Time index n');
Ylabel('Amplitude');
axis;
Sinusoidal Sequence

Amplitude

-1

-2

-3

-4

-5

10

Task 3:
Function addseq(x1,n1,x2,n2)
a1=length(x1);
a2=length(x2);
if a1>a2
l=a1-a2;
x2=[x2 zeros*(1:l)];
n=n1;

15

20

25
Time index n

30

35

40

45

50

Waqar azeem
Usman Jalil

Sp10-Bet-086
Fa11-BET-105

else

l=a2-a1;
x1=[x1 zeros*(1:l)];
n=n2;
end
x=x1+x2;
plot(n,x,'linewidth',2),grid on
end

12
11
10
9
8
7
6
5
4
3
2

Task 5:
n=-2:10;
X(1:13)=[1 2 3 4 5 6 7 6 5 4 3 2 1];
subplot(3,1,1)
stem(n,X,'linewidth',2),grid on
legend('x(n)');
x11(8:20)=2.*X;
x12(1:13)=3.*X;
x12=[x12 0 0 0 0 0 0 0];
x1=x11-x12;
n1=-6:13;
subplot(3,1,2)
stem(n1,x1,'linewidth',2),grid on
legend('x1(n)');
X(3:15)=[1 2 3 4 5 6 7 6 5 4 3 2 1];
x21(1:13)=X(3:15);
x21=[x21 0 0 0 0 0]
x22(6:18)=X(3:15).*X(3:15)
n2=-7:10;

Waqar azeem
Usman Jalil

Sp10-Bet-086
Fa11-BET-105

x2=x22+x21
subplot(3,1,3)
stem(n2,x2,'linewidth',2),grid on
legend('x2(n)');
10
x(n)
5
0
-2

10

20
x1(n)

0
-20
-40
-6

-4

-2

10

12

14

60
x2(n)

40
20
0
-8

-6

-4

-2

10

You might also like