Question

Please answer all the questions

Here is evenodd function:

function [xe, xo, m] = evenodd(x,n)
% Real signal decomposition into even and odd parts
% -------------------------------------------------
% [xe, xo, m] = evenodd(x,n)
%
if any(imag(x) ~= 0)
error('x is not a real sequence')
end
m = -fliplr(n);
m1 = min([m,n]); m2 = max([m,n]); m = m1:m2;
nm = n(1)-m(1); n1 = 1:length(n);
x1 = zeros(1,length(m));
x1(n1+nm) = x; x = x1;
xe = 0.5*(x + fliplr(x));
xo = 0.5*(x - fliplr(x));

Problem 2: a. Show that any signal can be decomposed into it an even and an odd component. Is the decomposition unique? b. Us

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

a)

If x(-n)=-x(n), then the signal is called as odd signal.--------------(1)

If x(-n)=x(n), then the signal is called as even signal.----------------(2)

Any signal can be expressed as a sum of even and odd components.

x(n)=xe(n)+xo(n) -----(3)

where xe(n) is the even component of x(n) and xo(n) is the even component of x(n).

Replace n by -n in (3)

x(-n)=xe(-n)+xo(-n) ----------------(4)

From(2), xe(-n)=xe(n)

From(1), xo(-n)=-xo(n)

Rewrite the equation(4),

x(-n)=xe(n)-xo(n) -----------------(5)

Add (5) and (3),

x(n)+x(-n)=2 xe(n)  

xe(n)= [x(n)+x(-n)]/2 -------------(6)

subtract (5) from (3),

x(n)-x(-n)=2 xo(n)  

xo(n)= [x(n)-x(-n)]/2 -------------(7)

Hence any signal can be decomposed into an even component and an odd component.

_______________________________________________________________________

b)

Steps:

1.Run the function file with the name 'evenodd.m'. This execution will show 'error: 'x' undefined '. Just neglect this error.

2.Run the main files one by one to get the waveforms.


function [xe, xo, m] = evenodd(x,n)
% Real signal decomposition into even and odd parts
% -------------------------------------------------
% [xe, xo, m] = evenodd(x,n)
%
if any(imag(x) ~= 0)
error('x is not a real sequence')
end
m = -fliplr(n);
m1 = min([m,n]); m2 = max([m,n]); m = m1:m2;
nm = n(1)-m(1); n1 = 1:length(n);
x1 = zeros(1,length(m));
x1(n1+nm) = x; x = x1;
xe = 0.5*(x + fliplr(x));
xo = 0.5*(x - fliplr(x));
endfunction


__________________________________________________________________

MAIN FILE :1


clc;
clear all;close all;
n1=-20:1:20
x1=cos((0.2*pi*n1)+(pi/4))
[xe1, xo1, m1] = evenodd(x1,n1)
subplot(411)
stem(n1,x1)
title('x1(n)=cos((0.2*pi*n1)+(pi/4))')
xlabel('n')
ylabel('x1(n)')

subplot(412)
stem(m1,xe1,'r')
title('Even component of x1(n)')
xlabel('n')
ylabel('xe(n)')

subplot(413)
stem(m1,xo1,'g')
xlabel('n')
ylabel('x0(n)')
title('Odd component of x1(n)')

y=xe1+xo1
subplot(414)
stem(n1,y,'b')
xlabel('n')
ylabel('x(n)')
title(' x1(n)=even +odd')

x1(n)-cos((0.2pi*n1)+(pi/4) E 0.5 20 10 -10 -20 Even component of x1(n) 20 10 -10 -20 Odd component of x1(n) 20 10 -10 -20 x

________________________________________________________________________________________

MAIN FILE :2


clc;
clear all;close all;
n2=-20:1:20
x2=(exp(-0.05*n2)).*(sin((0.1*pi*n2)+(pi/3)))
[xe2, xo2, m2] = evenodd(x2,n2)
subplot(221)
stem(n2,x2)
title('x2(n)=(exp(-0.05*n2)).*(sin((0.1*pi*n2)+(pi/3)))')
xlabel('n')
ylabel('x2(n)')

subplot(222)
stem(m2,xe2,'r')
title('Even component of x2(n)')
xlabel('n')
ylabel('xe(n)')

subplot(223)
stem(m2,xo2,'g')
xlabel('n')
ylabel('x0(n)')
title('Odd component of x2(n)')

y=xe2+xo2
subplot(224)
stem(n2,y,'b')
xlabel('n')
ylabel('x(n)')
title(' x2(n)=even +odd')

Even component of x2(n) x2(n)-(exp(-0.05n2)).(sin((0.1 *pin2)-(pi/3))) 3 0.5 0.5 -10 10 20 2 -20 20 20 -10 x2(n)-even todd

Observation:

The fourth plot of both problem show that the addition of even and odd components produces the same signal which is used for decomposition.

Add a comment
Know the answer?
Add Answer to:
Please answer all the questions Here is evenodd function: function [xe, xo, m] = evenodd(x,n) % R...
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