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_odd(t,x) which takes in the signal defined by the pair of vectors {t,x} and outputs the odd 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_odd (t,x)
% 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(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;
% ODD component
xo = 0.5*(x - fliplr(x))
