1208 1

[Weka及其他] MATLAB课程:代码示例之Mathematics(五) [推广有奖]

企业贵宾

巨擘

0%

还不是VIP/贵宾

-

威望
4
论坛币
624047 个
通用积分
178.9606
学术水平
918 点
热心指数
987 点
信用等级
841 点
经验
398972 点
帖子
9798
精华
48
在线时间
17322 小时
注册时间
2014-8-19
最后登录
2022-11-2

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

MATLAB课程:代码示例之Mathematics(五)

FFT for Spectral Analysis


This example shows the use of the FFT function for spectral analysis. A common use of FFT's is to find the frequency components of a signal buried in a noisy time domain signal.


First create some data. Consider data sampled at 1000 Hz. Start by forming a time axis for our data, running from t=0 until t=.25 in steps of 1 millisecond. Then form a signal, x, containing sine waves at 50 Hz and 120 Hz.

t = 0:.001:.25;x = sin(2*pi*50*t) + sin(2*pi*120*t);


Add some random noise with a standard deviation of 2 to produce a noisy signal y. Take a look at this noisy signal y by plotting it.

y = x + 2*randn(size(t));plot(y(1:50))title('Noisy time domain signal')


Clearly, it is difficult to identify the frequency components from looking at this signal; that's why spectral analysis is so popular.

Finding the discrete Fourier transform of the noisy signal y is easy; just take the fast-Fourier transform (FFT).

Y = fft(y,251);


Compute the power spectral density, a measurement of the energy at various frequencies, using the complex conjugate (CONJ). Form a frequency axis for the first 127 points and use it to plot the result. (The remainder of the points are symmetric.)

Pyy = Y.*conj(Y)/251;f = 1000/251*(0:127);plot(f,Pyy(1:128))title('Power spectral density')xlabel('Frequency (Hz)')


Zoom in and plot only up to 200 Hz. Notice the peaks at 50 Hz and 120 Hz. These are the frequencies of the original signal.

plot(f(1:50),Pyy(1:50))title('Power spectral density')xlabel('Frequency (Hz)')





二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:mathematics Mathematic MATLAB课程 Thematic MATLAB MATLAB课程 代码示例 Mathematics FFTforSpectralAnalysis

已有 1 人评分经验 学术水平 收起 理由
Nicolle + 20 + 1 分析的有道理

总评分: 经验 + 20  学术水平 + 1   查看全部评分

本帖被以下文库推荐


https://www.cda.cn/?seo-luntan
高薪就业·数据科学人才·16年教育品牌
沙发
我有我的love 在职认证  发表于 2016-3-8 14:05:32 |只看作者 |坛友微信交流群
好专业,谢谢楼主!

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-11-6 07:42