收藏 分销(赏)

傅里叶变换matlab程序.doc

上传人:人****来 文档编号:3843910 上传时间:2024-07-22 格式:DOC 页数:3 大小:16.50KB 下载积分:5 金币
下载 相关 举报
傅里叶变换matlab程序.doc_第1页
第1页 / 共3页
傅里叶变换matlab程序.doc_第2页
第2页 / 共3页


点击查看更多>>
资源描述
Fs = 1000; % Sampling frequency采样频率 T = 1/Fs; % Sample time采样周期 L = 1000; % Length of signal信号长度(点的个数) t = (0:L-1)*T; % Time vector时间向量(序列)(用来画图) % Sum of a 50 Hz sinusoid and a 120 Hz sinusoid一个50赫兹正弦加上120赫兹正弦 x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); y = x + 2*randn(size(t)); % Sinusoids plus noise正弦之和加上正态噪声 figure(1); plot(Fs*t(1:50),y(1:50)) title('Signal Corrupted with Zero-Mean Random Noise')%被零均值噪声祸害的信号 xlabel('time (milliseconds)') %It is difficult to identify the frequency components by looking at the original signal. Converting to the frequency domain, the discrete Fourier transform of the noisy signal y is found by taking the fast Fourier transform (FFT): %从时域上直接看原信号难以确定各频率分量. 通过使用快速傅里叶变换FFT, 实现了含噪声信号Y的离散傅里叶变换,从而把信号转换到频域上(确定频率分量) NFFT = 2^nextpow2(L); % Next power of 2 from length of y Y = fft(y,NFFT)/L; f = Fs/2*linspace(0,1,NFFT/2+1); % Plot single-sided amplitude spectrum. figure(2); plot(f,2*abs(Y(1:NFFT/2+1))) title('Single-Sided Amplitude Spectrum of y(t)') xlabel('Frequency (Hz)') ylabel('|Y(f)|') A=xlsread('SHUJU2.xlsx') ; %这里的SHUJU1.xlsx是数据 FS=1000; % FS是采样率 T=1/FS; L=length(A) t=(0:L-1)*T; figure(3); plot(FS*t(1:50),A(1:50)); title('Signal Corrupted with Zero-Mean Random Noise')%被零均值噪声祸害的信号 xlabel('time (milliseconds)') figure(6); NFFT = 2^nextpow2(L) % nextpow2(L)使得2^p>=L的最小的p Y = fft(A,NFFT)/L; f = FS/2*linspace(0,1,NFFT/2+1); plot(f,2*abs(Y(1:NFFT/2+1))); title('Single-Sided Amplitude Spectrum of y(t)') xlabel('Frequency (Hz)') ylabel('|Y(f)|') THANKS !!! 致力为企业和个人提供合同协议,策划案计划书,学习课件等等 打造全网一站式需求 欢迎您的下载,资料仅供参考
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服