将一个序列分解成奇偶序列的组合
程序员文章站
2024-02-29 10:16:22
...
clc
clear all
close all
%% original sequence
t = -10:1:10;
hn1 = cos(2*pi*0.1*t);
hnf1 = fliplr(hn1);
hn2 = sin(2*pi*0.1*t);
hnf2 = fliplr(hn2);
hn3 = (hn1 + hn2)/2;
hnf3 = fliplr(hn3);
%% even sequence
he1 = 1/2*(hn1 + hnf1);
he2 = 1/2*(hn2 + hnf2);
he3 = 1/2*(hn3 + hnf3);
%% odd sequence
ho1 = 1/2*(hn1 - hnf1);
ho2 = 1/2*(hn2 - hnf2);
ho3 = 1/2*(hn3 - hnf3);
%% figure plot
figure('Name','y轴对称序列','NumberTitle','off')
subplot(3,1,1)
stem(t,hn1)
title('原始序列')
subplot(3,1,2)
stem(t,he1)
title('分解出偶序列')
subplot(3,1,3)
stem(t,ho1)
title('分解出奇序列')
figure('Name','原点对称序列','NumberTitle','off')
subplot(3,1,1)
stem(t,hn2)
title('原始序列')
subplot(3,1,2)
stem(t,he2)
title('分解出偶序列')
subplot(3,1,3)
stem(t,ho2)
title('分解出奇序列')
figure('Name','非对称序列','NumberTitle','off')
subplot(3,1,1)
stem(t,hn3)
title('原始序列')
subplot(3,1,2)
stem(t,he3)
title('分解出偶序列')
subplot(3,1,3)
stem(t,ho3)
title('分解出奇序列')
上一篇: Redis数据结构详解