• 大小: 6KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-07-05
  • 语言: Matlab
  • 标签: matlab  

资源简介

谱估计代码,含有改进经典谱估计和现代谱估计。

资源截图

代码片段和文件信息

%----------------------------------------------------------------------%
%%%%%%%%%%%%%classical spectrum estimation%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%Liudan%%%%%%%%%%%
%%%2010-12-11%%%%%%%%

clear all
close all
clc
fs=1000;
Ts=1/fs;
n=1024;
t=[0:1:n-1]*Ts;
%%%%%%%%%%周期图法测频精度仿真,改变信号的长度%%%%%%%%%%%%%%%%%%%%%%%%
fc1=150;
fc2=150.1;
fc3=150.015;
snr=0;
sn=10.^(snr/10);
wc1=50*2/fs;
wc2=450*2/fs;
w=[wc1 wc2];
h=fir1(128w);
n0=randn(1n);
n1=conv(n0h);
n1=n1(128/2+1:end-128/2);
std=var(n1);
x=sin(2*pi*fc1*t)+sin(2*pi*fc2*t)+sin(2*pi*fc3*t);
n2=sqrt(3/(2*sn*std))*n1;
n3=fft(n21024);
f=[0:511]*fs/1024;
figureplot(fn3(1:512));
xlabel(‘频率/Hz‘);
title(‘200Hz带限噪声‘);
y=x+n2;
Nfft1=1024;
Sw1=fft(yNfft1);
A1=abs(Sw1).^2/Nfft1;
% A1=10*log10(A1);
f2=fs*[0:Nfft1/2]/Nfft1;
% figureplot(f2A1(1:1+Nfft1/2));
% xlabel(‘频率/Hz‘);
% ylabel(‘功率谱‘);
% title(‘1024点信号长度周期图法测频精度分析‘);
% % %%%%%%%%%周期图法频谱分辨率的仿真,改变矩形窗函数的长度%%%%%%%%%%%%%%%%%%%
fc4=300;
fc5=160;
fc6=350;
fc8=400;
fc7=420;
x1=sin(2*pi*fc7*t)+sin(2*pi*fc4*t)+sin(2*pi*fc1*t)+sin(2*pi*fc8*t)+sin(2*pi*fc6*t)+sin(2*pi*fc5*t);
x1=2*sin(2*pi*fc1*t)+2.^0.5*sin(2*pi*fc5*t);
Nfft0=1024*1024;
x12=fft(x1Nfft0);
f2=fs*[0:Nfft0/2]/Nfft0;
x12=abs(x12);
% % figureplot(f2x12(1:1+Nfft0/2));
% % xlabel(‘频率/Hz‘);
% % ylabel(‘频谱‘);
% % title(‘信号的fft‘);
n22=sqrt(3/(sn*std))*n1;
y1=x1+n22;
% y1=x1;
% window1=rectwin(1024)‘;
% window1=[window1 zeros(1length(t)-length(window1))];
% y11=y1.*window1;
% Nfft2=1024;
% Sw2=fft(y11Nfft2);
% A2=abs(Sw2).^2/Nfft2;
% A2=10*log10(A2);
% f22=fs*[0:Nfft2/2]/Nfft2;
% figureplot(f22A2(1:1+Nfft2/2));
% xlabel(‘频率/Hz‘);
% ylabel(‘功率谱/dB‘);
% title(‘512点矩形窗周期图法‘);
% % %%%%%%%%%%%%%周期图法改变窗的类型以后的仿真%%%%%%%%%%
window2=rectwin(256)‘;
window2=[window2 zeros(1length(x)-length(window2))];
y11=y1.*window2;
Nfft2=1024*8;
Sw2=fft(y11Nfft2);
A2=abs(Sw2).^2/Nfft2;
A2=10*log10(A2);
f22=fs*(0:Nfft2/2)/Nfft2;
figureplot(f22A2(1:Nfft2/2+1));
xlabel(‘频率/Hz‘);
ylabel(‘功率谱/dB‘);
title(‘矩形窗周期图法‘);
window3=bartlett(256)‘;
window3=[window3 zeros(1length(x)-length(window3))];
y11=y1.*window3;
Nfft2=1024*8;
Sw2=fft(y11Nfft2);
A2=abs(Sw2).^2/Nfft2;
A2=10*log10(A2);
f22=fs*(0:Nfft2/2)/Nfft2;
figureplot(f22A2(1:Nfft2/2+1));
xlabel(‘频率/Hz‘);
ylabel(‘功率谱/dB‘);
title(‘bartlett窗周期图法‘);
window4=hamming(256)‘;
window4=[window4 zeros(1length(x)-length(window4))];
y11=y1.*window4;
Nfft2=1024*8;
Sw2=fft(y11Nfft2);
A2=abs(Sw2).^2/Nfft2;
A2=10*log10(A2);
f22=fs*(0:Nfft2/2)/Nfft2;
figureplot(f22A2(1:Nfft2/2+1));
xlabel(‘频率/Hz‘);
ylabel(‘功率谱/dB‘);
title(‘hamming窗周期图法‘);
window5=hann(256)‘;
window5=[window5 zeros(1length(x)-length(window5))];
y11=y1.*window5;
Nfft2=1024*8;
Sw2=fft(y11Nfft2);
A2=abs(Sw2).^2/Nfft2;
A2=10*log10(A2);
f22=fs*(0:Nfft2/2)/Nfft2;
figureplot(f22A2(1:Nfft2/2+1));
xlabel(‘频率/Hz‘);
ylabel(‘功率谱dB‘);
title(‘hann窗周期图法‘);
window6=blackman(256)‘;
window6=[window6 zeros(1length(x)-leng

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3830  2010-12-16 19:23  现代谱估计 matlab程序\classicalestimation.asv

     文件       3830  2010-12-16 19:23  现代谱估计 matlab程序\classicalestimation.m

     文件       2735  2010-12-16 09:26  现代谱估计 matlab程序\classicalimprovement.m

     文件       1415  2010-12-14 19:41  现代谱估计 matlab程序\LD.m

     文件       1390  2010-12-14 13:56  现代谱估计 matlab程序\modemspetrumestimation.m

     文件       1124  2010-12-14 13:33  现代谱估计 matlab程序\modernspetrumestimation.m

     目录          0  2012-11-12 21:44  现代谱估计 matlab程序

----------- ---------  ---------- -----  ----

                14324                    7


评论

共有 条评论