我们现在通过以下代码在Matlab中画出这个正弦曲线
fo = 4; %frequency of the sine wave
Fs = 100; %sampling rate
Ts = 1/Fs; %sampling time interval
t = 0:Ts:1-Ts; %sampling period
n = length(t); %number of samples
y = 2*sin(2*pi*fo*t); %the sine curve
%plot the cosine curve in the time domain
sinePlot = figure;
plot(t,y)
变换(dft)或快速傅立叶变换(fft)分析频谱,估计信 的频率,但dft存在频谱泄露和栏栅效应,当频谱峰值谱线对应频率不能与窗函数频谱主瓣的中心重合时便产生频率测量误差matlab离散信 的时域和频域分析,所以需要研究离散频谱分析校正理论来消除这个误差。[0009]步骤s1:对调频连续波雷达系统采集的中频信 进行离散傅里叶频谱计算,得到频谱峰值谱线 km所对应的粗计算的中频信 频率和距离。根据随机过程理论, Karman型自相关函数在水平和垂直方向上的自相功率谱是其自相关函数的傅氏变换,因此,选择自相 关长度a和b,可以方便地产生各种不同特点的随关函数 (x,z)以及自相关长度a、b,对 (x,z)进行 φ φ 机介质模型,而自相关长度a和b分别描述了随机二维傅氏变换 介质在水平(x)方向及深度(z)方向上非均匀异常 + + ∞ ∞ -i(kx+kz) φ(k,k)= φ(x,z)e x z dxdz(10) 的平均尺度。
axis([0,100,0,120])
效果如下:
这张图就满足了我们的需求,我们得到了在+4和-4处的峰值,而且幅值为1.
为FFT定义一个函数来获取右边频谱
从上图可以看出,FFT变换得到的频谱是左右对称的,因此,我们只需要其中一边就能获得信 的所有信息,我们一般保留正频率一侧。
以下的函数对上面的自定义函数做了一些修改,让它可以帮助我们只画出信 的正频率一侧
function [X,freq]=positiveFFT(x,Fs)
N=length(x); %get the number of points
k=0:N-1; %create a vector from 0 to N-1
T=N/Fs; %get the frequency interval
freq=k/T; %create the frequency range
X=fft(x)/N; % normalize the data
%only want the first half of the FFT, since it is redundant
cutOff = ceil(N/2);
%take only the first half of the spectrum
X = X(1:cutOff);
freq = freq(1:cutOff);
和前面一样,使用正弦信 做一个示例,下面是示例代码
[YfreqDomain,frequencyRange] = positiveFFT(y,Fs);
positiveFFT = figure;
stem(frequencyRange,abs(YfreqDomain));
set(positiveFFT,’Position’,[500,500,500,300])
xlabel(‘Freq (Hz)’)
ylabel(‘Amplitude’)
title(‘Using the positiveFFT function’)
grid
axis([0,20,0,1.5])
效果如下:
相关资源:Yalefree雅乐简谱打谱软件_打谱软件-WindowsServer工具类资源…
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!