Question

Question 2 (a) Determine whether the discrete time system which has an output y[n] 2*x[n] over the nterval 010 is linear or n

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)MATLAB:


clc;close all;clear all;

n=0:1:10
%y1(n) to input x1(n)=sin(2*pi*n/10)
x1=sin(2*pi*n/10)
y1=2*x1
subplot(421)
stem(n,x1,'r');xlabel('n');ylabel('x1(n)');title('x1(n)=sin(2*pi*n/10)')
subplot(422)
stem(n,y1,'b');xlabel('n');ylabel('y1(n)');title('y1(n)=2*x1(n)')

%y2(n) to input x2(n)=cos(2*pi*n/10)
x2=cos(2*pi*n/10)
y2=2*x2
subplot(423)
stem(n,x2,'g');xlabel('n');ylabel('x2(n)');title('x2(n)=cos(2*pi*n/10)')
subplot(424)
stem(n,y2,'b');xlabel('n');ylabel('y2(n)');title('y2(n)=2*x2(n)')

%y3(n) to input x3(n)=x1(n)+x2(n)
x3=x1.+x2
y3=2*x3
subplot(425)
stem(n,x3,'m');xlabel('n');ylabel('x3(n)');title('x3(n)=x1(n)+x2(n)')
subplot(426)
stem(n,y3,'b');xlabel('n');ylabel('y3(n)');title('y3(n)=2*x3(n)')

%y3(n) to input x3(n)=x1(n)+x2(n)
y4=y1+y2
subplot(427)
stem(n,y4,'b');xlabel('n');ylabel('y4(n)');title('y4(n)=y1(n)+y2(n)')

if(y3==y4)
disp('outputs consistent with a linear system')
else
disp('Not linear')
end

y1 (n)-2x1(n) x1(n)-sin(2*pi*n/10) E 0.5 10 y2(n)-2x2(n) x2(n)-cos(2 pi*n/10) 10 10 y3(n)-2*x3(n) x3(n)-x1(n)+x2(n) 10 4 10

Command window:

y3 =

Columns 1 through 9:

2.00000 2.79360 2.52015 1.28408 -0.44246 -2.00000 -2.79360 -2.52015 -1.28408

Columns 10 and 11:

0.44246 2.00000

y4 =

Columns 1 through 9:

2.00000 2.79360 2.52015 1.28408 -0.44246 -2.00000 -2.79360 -2.52015 -1.28408

Columns 10 and 11:

0.44246 2.00000

outputs consistent with a linear system

____________________________________________________

b) i) Linearity for x1=[0,1],x2=n

MATLAB:


clc;close all;clear all;

n=0:1:10
%y1(n) to input x1(n)=[0,1]

x1=[0,1,zeros(1,length(n)-2)]
y1=x1.^2
subplot(421)
stem(n,x1,'r');xlabel('n');ylabel('x1(n)');title('x1(n)')
subplot(422)
stem(n,y1,'b');xlabel('n');ylabel('y1(n)');title('y1(n)=x1(n).^2')

%y2(n) to input x2(n)=n
x2=n
y2=x2.^2
subplot(423)
stem(n,x2,'g');xlabel('n');ylabel('x2(n)');title('x2(n)')
subplot(424)
stem(n,y2,'b');xlabel('n');ylabel('y2(n)');title('y2(n)=x2(n).^2')

%y3(n) to input x3(n)=x1(n)+x2(n)
x3=x1.+x2
y3=x3.^2
subplot(425)
stem(n,x3,'m');xlabel('n');ylabel('x3(n)');title('x3(n)=x1(n)+x2(n)')
subplot(426)
stem(n,y3,'b');xlabel('n');ylabel('y3(n)');title('y3(n)=x3(n).^2')

%y3(n) to input x3(n)=x1(n)+x2(n)
y4=y1+y2
subplot(427)
stem(n,y4,'b');xlabel('n');ylabel('y4(n)');title('y4(n)=y1(n)+y2(n)')

if(y3==y4)
disp('outputs consistent with a linear system')
else
disp('Not linear')
end

y1 (n)-x1(n). x1 (n) 10 10 x2(n) 10 10 y3(n)-x3(n) x3(n)-x1(n)+x2(n) 100 2 10 4 10 y4(n)-y1 (n)+y2(n) 100

Command window:

y3 =

0 4 4 9 16 25 36 49 64 81 100

y4 =

0 2 4 9 16 25 36 49 64 81 100

Not linear

ii)Linearity:


clc;close all;clear all;

n=0:1:10
%y1(n) to input x1(n)=[0,1]

x1=[0,1,zeros(1,length(n)-2)]
y1=x1.^2
subplot(421)
stem(n,x1,'r');xlabel('n');ylabel('x1(n)');title('x1(n)=sin(2*pi*n/10)')
subplot(422)
stem(n,y1,'b');xlabel('n');ylabel('y1(n)');title('y1(n)=x1(n).^2')

%y2(n) to input x2(n)=n
x2=n
y2=x2.^2
subplot(423)
stem(n,x2,'g');xlabel('n');ylabel('x2(n)');title('x2(n)=cos(2*pi*n/10)')
subplot(424)
stem(n,y2,'b');xlabel('n');ylabel('y2(n)');title('y2(n)=x2(n).^2')

%y3(n) to input x3(n)=x1(n)+x2(n)
x3=x1.+x2
y3=x3.^2
subplot(425)
stem(n,x3,'m');xlabel('n');ylabel('x3(n)');title('x3(n)=x1(n)+x2(n)')
subplot(426)
stem(n,y3,'b');xlabel('n');ylabel('y3(n)');title('y3(n)=x3(n).^2')

%y3(n) to input x3(n)=x1(n)+x2(n)
y4=y1+y2
subplot(427)
stem(n,y4,'b');xlabel('n');ylabel('y4(n)');title('y4(n)=y1(n)+y2(n)')

if(y3==y4)
disp('outputs consistent with a linear system')
else
disp('Not linear')
end

y1 (n)-2x1(n)+5del(n) x1(n) 0.8 0.6 0.2 10 10 y2(n)-2x2(n)+5del(n) x2(n) 20 10 10 y3 (n)-2x3(n)+5del(n) x3(n)-x1(n)+x2(n) 20

Command window:

y3 =

5 4 4 6 8 10 12 14 16 18 20

y4 =

10 4 4 6 8 10 12 14 16 18 20

Not linear

b(i) Time invariant:


clc;close all;clear all;

n=0:1:4
%y1(n) to input x1(n)=[0,1]

x=[0,1,zeros(1,length(n)-2)]
subplot(221)
stem(n,x,'r');xlabel('n');ylabel('x(n)');title('x(n)')
n0=2
%plot y(n-k)
y=x.^2
for k=1:length(n)
y1(k+n0)=y(k)
end
m=0:1:max(n)+n0
subplot(222)
stem(m,y1,'b');xlabel('n');ylabel('y(n-k)');title('y(n-k)')

for k=1:length(n)
x1(k+n0)=x(k)
end
subplot(223)
stem(m,x1,'r');xlabel('n');ylabel('x(n-no)');title('x(n-no)')
y=x1.^2
subplot(224)
stem(m,y,'b');xlabel('n');ylabel('y(n,k)');title('y(n,k)')

if(y1==y)
disp('the system is time invariant')
else
disp('the system is time variant')
end


x(n) y(n-k) 0.8 0.8 0.6 0.6 0.4 0.4 0.2 0.2 3 4 x(n-no) Y(n,k) 0.8 0.8 0.6 0.6 0.4 0.4 0.2 0.2

Command window:

the system is time invariant
>> y
y =

0 0 0 1 0 0 0

>> y1
y1 =

0 0 0 1 0 0 0

ii)time invariant:


clc;close all;clear all;

n=0:1:4
%y1(n) to input x1(n)=[0,1]

x=[0,1,zeros(1,length(n)-2)]
subplot(221)
stem(n,x,'r');xlabel('n');ylabel('x(n)');title('x(n)')
n0=2
%plot y(n-k)
y=(2*x)+(5*(n==0))
for k=1:length(n)
y1(k+n0)=y(k)
end
m=0:1:max(n)+n0
subplot(222)
stem(m,y1,'b');xlabel('n');ylabel('y(n-k)');title('y(n-k)')

for k=1:length(n)
x1(k+n0)=x(k)
end
subplot(223)
stem(m,x1,'r');xlabel('n');ylabel('x(n-no)');title('x(n-no)')
y=(2*x1)+(5*(m==0))
subplot(224)
stem(m,y,'b');xlabel('n');ylabel('y(n,k)');title('y(n,k)')

if(y1==y)
disp('the system is time invariant')
else
disp('the system is time variant')
end

x(n) y(n-k) 0.8 4 0.6 0.4 0.2 3 x(n-no) Y(n,k) 0.8 4 0.6 0.4 0.2

the system is time variant
>> y
y =

5 0 0 2 0 0 0

>> y1
y1 =

0 0 5 2 0 0 0

Add a comment
Know the answer?
Add Answer to:
Question 2 (a) Determine whether the discrete time system which has an output y[n] 2*x[n] over...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT