You are to create a matlab function that has the following f
You are to create a matlab function that has the following form: function y = Component_even(t,x) which takes in the signal defined by the pair of vectors {t,x} and outputs the even component of the signal with samples vector y. The output vector y is paired with the input vector t to form a signal.
Solution
function y =Component_even (t,x)
if any(imag(x) ~= 0)
error(\'x is not a real sequence\')
end
m = -fliplr(t);
m1 = min([m,t]);
m2 = max([m,t]);
m = m1:m2;
tm = t(1)-m(1);
t1 = 1:length(n);
x1 = zeros(1,length(m));
x1(t1+tm) = x;
x = x1;
% EVEN component
xe = 0.5*(x + fliplr(x))
