⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geng22.m

📁 用matlab仿真的信号的fft变换的时域,频域图形
💻 M
字号:
clear;
clc;
close all;

N = 16;
n =0:N-1;

x4 = cos(pi*n/4);
x5 = sin(pi*n/8);

x7 = x4 + x5;
x8 = x4 + j*x5;

x4_fft = fft(x4, N);
k_x4   = 0 : length(x4)-1;
k_x4_fft = 0:length(x4_fft)-1;
mag4 = abs(x4_fft)
figure(1);
subplot(421);
stem(k_x4, x4,'.');
subplot(422);
stem(k_x4_fft,mag4,'*');

x5_fft = fft(x5, N);
k_x5   = 0 : length(x5)-1;
k_x5_fft = 0:length(x5_fft)-1;
mag5 = abs(x5_fft)
subplot(423);
stem(k_x5, x5,'.');
subplot(424);
stem(k_x5_fft,mag5,'*');

x7_fft = fft(x7, N);
k_x7   = 0 : length(x7)-1;
k_x7_fft = 0:length(x7_fft)-1;
mag7 = abs(x7_fft);
subplot(425);
stem(k_x7, x7,'.');
subplot(426);
stem(k_x7_fft,mag7,'*');


x8_fft = fft(x8, N)
k_x8   = 0 : length(x8)-1;
k_x8_fft = 0:length(x8_fft)-1;
mag8 = abs(x8_fft);
subplot(427);
stem(k_x8, abs(x8),'.');
subplot(428);
stem(k_x8_fft,mag8,'*');

k7_fft=conj(x7_fft);
new_x4_fft=abs((x7_fft+k7_fft)/2)
new_x5_fft=abs((k7_fft-x7_fft)/2)
figure(2);
subplot(421);
stem(k_x4_fft,mag4,'.');
k_new_x4_fft = 0:length(new_x4_fft)-1;
subplot(422);
stem(k_new_x4_fft,new_x4_fft,'*');

subplot(423);
stem(k_x5_fft,mag5,'.');
k_new_x5_fft = 0:length(new_x5_fft)-1;
subplot(424);
stem(k_new_x5_fft,new_x5_fft,'*');

k8_fft(1)=conj(x8_fft(1));
for m=2:N
    m_l=m-2;
    k8_fft(m)=conj(x8_fft(N-m_l));
end
k8_fe=(x8_fft+k8_fft)/2;
k8_fo=(x8_fft-k8_fft)/2;
new_x4=ifft(k8_fe,N)
new_x5=ifft(k8_fo,N)/j
subplot(425);
stem(k_x4, x4,'.');
k_new_x4=0:length(new_x4)-1;
subplot(426);
stem(k_new_x4, new_x4,'*');
subplot(427);
stem(k_x5, x5,'.');
k_new_x5=0:length(new_x5)-1;
subplot(428);
stem(k_new_x5, new_x5,'*');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -