?? samp3_10.m
字號(hào):
%Samp3_10
N=100;dt=1; %數(shù)據(jù)點(diǎn)數(shù)及采樣間隔
n = 0:N-1; t=n*dt; %時(shí)間序列
x = sin(2*pi*0.1*t)+0.5*cos(2*pi*0.2*t); %數(shù)據(jù)信號(hào)
xe=0.5*cos(2*pi*0.2*t); %信號(hào)中的偶函數(shù)部分
xo=sin(2*pi*0.1*t); %信號(hào)中的奇函數(shù)部分
k = 0:N-1; f=k/(N*dt); %頻率序列
X = dfs(x,N); % 對(duì)信號(hào)進(jìn)行Fourier變換
XE = dfs(xe,N); % 對(duì)信號(hào)偶函數(shù)部分進(jìn)行Fourier變換
XO = dfs(xo,N); % 對(duì)信號(hào)偶函數(shù)部分進(jìn)行Fourier變換
XR=real(X); %提取信號(hào)Fourier變換的實(shí)部
XI=imag(X); %提取信號(hào)Fourier變換的虛部
subplot(2,2,1); plot(f,XR*2/N); grid on; %繪出信號(hào)Fourier變換的實(shí)部
xlabel('頻率/Hz'); ylabel('Re(X)');
title('信號(hào)Fourier變換的實(shí)部')
subplot(2,2,2); plot(f,XI*2/N); grid on; %繪出信號(hào)Fourier變換的虛部
xlabel('頻率/Hz'); ylabel('Im(X)');
title('信號(hào)Fourier變換的虛部')
subplot(2,2,3); plot(f,real(XE)*2/N); grid on;%繪出信號(hào)偶函數(shù)部分Fourier變換的實(shí)部
xlabel('頻率/Hz'); ylabel('XE');
title('信號(hào)偶函數(shù)部分的Fourier變換')
subplot(2,2,4); plot(f,imag(XO)*2/N);grid on;%繪出信號(hào)奇函數(shù)部分Fourier變換的虛部
xlabel('頻率/Hz'); ylabel('XO');
title('信號(hào)奇函數(shù)部分的Fourier變換')
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -