Main Content

Basic Spectral Analysis

The Fourier transform is a tool for performing frequency and power spectrum analysis of time-domain signals.

光谱分析量

光谱分析研究了离散,均匀采样数据中包含的频谱。傅立叶变换是一种工具,可以通过在频率空间中表示时间或空间信号的频率组件。下表列出了用于表征和解释信号属性的常见数量。要了解有关傅立叶变换的更多信息,请参阅傅立叶变换

Quantity 描述
X

采样数据

n= length(x)

Number of samples

FS

样品频率(每单位时间或空间样品)

dt = 1/fs

每个样品的时间或空间增加

t =(0:n-1)/fs

数据的时间或空间范围

y = fft(x)

离散数据转换(DFT)

ABS(Y)

DFT的振幅

(abs(y).^2)/n

Power of the DFT

FS/n

频率增加

f =(0:n-1)*(fs/n)

Frequency range

FS/2

Nyquist频率(频率范围的中点)

Noisy Signal

傅立叶变换可以计算被随机噪声损坏的信号的频率成分。

Create a signal with component frequencies at 15 Hz and 40 Hz, and inject random Gaussian noise.

rng('default')fs = 100;样本频率(Hz)的%t = 0:1/fs:10-1/fs;% 10 second span time vectorx =(1.3)*sin(2*pi*15*t)...% 15 Hz component+(1.7)*sin(2*pi*40*(t-2))...%40 Hz组件+ 2.5*randn(size(t));%高斯噪声;

信号的傅立叶变换标识其频率分量。在matlab®中fft有趣的ction computes the Fourier transform using a fast Fourier transform algorithm. Usefftto compute the discrete Fourier transform of the signal.

y = fft(x);

将功率谱绘制为频率的函数。噪声掩盖了基于时间空间中信号的频率组件,但傅立叶变换却将其显示为峰值。

n =长度(x);样品数量的%f =(0:n-1)*(fs/n);% frequency rangepower = abs(y)。^2/n;% power of the DFT情节(F,Power)Xlabel('Frequency')ylabel('力量'

图包含一个轴对象。轴对象包含一个类型行的对象。

In many applications, it is more convenient to view the power spectrum centered at 0 frequency because it better represents the signal's periodicity. Use thefftshift有趣的ction to perform a circular shift ony并绘制0个以0个为中心的功率。

y0 = fftShift(y);%移动y值f0 =(-n/2:n/2-1)*(fs/n);% 0-centered frequency rangepower0 = abs(y0)。^2/n;%0中心功率情节(F0,Power0)Xlabel('Frequency')ylabel('力量'

图包含一个轴对象。轴对象包含一个类型行的对象。

音频信号

您可以使用傅立叶变换来分析音频数据的频谱。

文件蓝色包含来自加利福尼亚沿海水下麦克风记录的太平洋蓝鲸发声的音频数据。该文件来自由动物发声库维护的Cornell University Bioacoustics Research Program

因为蓝鲸的电话太低,所以它们几乎无法听到人类的声音。数据中的时间尺度被压缩了10倍,以提高音高并使呼叫更清晰可听见。阅读并绘制音频数据。您可以使用命令声音(x,fs)to listen to the audio.

鲸鱼='bluewhale.au'; [x,fs] = audioread(whaleFile); plot(x) xlabel(“样本号”)ylabel('Amplitude'

图包含一个轴对象。轴对象包含一个类型行的对象。

第一个声音是“颤音”,然后是三个“ mo吟”。此示例分析了一个mo吟。指定大约由第一个mo吟组成的新数据,并纠正时间数据以说明10个速度。将截短信号绘制为时间的函数。

mo吟= x(2.45e4:3.10e4);t = 10*(0:1/fs :(长度(mo吟)-1)/fs);情节(t,mo吟)xlabel('Time (seconds)')ylabel('Amplitude')xlim([0 t(end)])

图包含一个轴对象。轴对象包含一个类型行的对象。

数据的傅立叶变换标识音频信号的频率组件。在某些应用程序中,可以处理大量数据fft, it is common to resize the input so that the number of samples is a power of 2. This can make the transform computation significantly faster, particularly for sample sizes with large prime factors. Specify a new signal lengthn那是2的力量,并使用fft功能以计算信号的离散傅立叶变换。fft自动将原始数据与零一起填充以增加样本量。

m =长度(mo吟);% original sample lengthn = pow2(nextPow2(m));% transform lengthy = fft(mo吟,n);% DFT of signal

调整由于加速因子而引起的频率范围,并计算和绘制信号的功率谱。该图表明mo吟由17 Hz左右的基本频率和一系列谐波组成,其中第二个谐波被强调。

f =(0:n-1)*(fs/n)/10; power = abs(y).^2/n; plot(f(1:floor(n/2)),power(1:floor(n/2))) xlabel('Frequency')ylabel('力量'

图包含一个轴对象。轴对象包含一个类型行的对象。

也可以看看

|||||

Related Topics