序列 x(n)的奇偶分解的公式为:
编写一个序列 x(n) 的奇偶分解式 xe(n) 和 xo(n),需要考虑的问题是序列长度,下标的变化。
这里必须做个声明,下面的程序中用到了前几篇博客中的几个函数,这里给贴出来:
信号相加:
function [y,n] = sigadd(x1,n1,x2,n2)
% implements y(n) = x1(n) + x2(n)
% [y,n] = sigadd(x1,n1,x2,n2)
%____________________________________
% y = sum sequence over n, which includes n1 and n2
% x1 = first sequence over n1
% x2 = second sequence over n2( n2 can be different from n1)
%
n = min( min(n1), min(n2) ):max( max(n1), max(n2) ); %duration of y(n)
y1 =