property3.m
来自「用dsp解压mp3程序的算法」· M 代码 · 共 30 行
M
30 行
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% property3 - Program for showing Circular shifting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x = [1 0.8 0.6 0.4 0.2 0.1 0.3 0.5];
% Circular shift by 2 time units
shift = 2;
n = 0:1:length(x)-1;
n = mod(n-shift,8);
x_cs = x(n+1);
figure;
subplot(211); stem(0:1:length(x)-1,x); title('Original sequence');
subplot(212); stem(0:1:length(x)-1,x_cs); title('Circular shifted by 2');
% FFT of x and x_cs
X = fft(x); mag_X = abs(X); phase_X = angle(X);
X_cs = fft(x_cs); mag_X_cs = abs(X_cs); phase_X_cs = angle(X_cs);
figure; n1 = 0:1:7
subplot(221), stem(n1,mag_X); title ('Magnitude of original seq');
subplot(222), stem(n1,phase_X); title ('Phase of original seq');
subplot(223), stem(n1,mag_X_cs); title ('Magnitude of Circular-shifted seq');
subplot(224), stem(n1,phase_X_cs); title ('Phase of Circular-shifted seq');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?