Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2008-02-29
年龄: 39
帖子: 2
声望力: 0 ![]() |
![]()
我做的题目是 利用小波变换检测轴承外环故障
在matlab7.0中输入程序出不来图像,只出现 ??? Error using ==> fread Invalid file identifier -1. 请问这是什么问题? 是不是我的软件有问题啊? 望帮忙解答,小弟不胜感激!! 程序如下: %采样频率 fs=10000; %轴承外环故障信号 fid=fopen('bearingout.dat','r');%故障 N=1024; xdata=fread(fid,N,'int16'); fclose(fid); xdata=(xdata-mean(xdata))/std(xdata,1); %时域波形 figure(1); plot(1:N,xdata); xlabel('样本序号 n/个'); ylabel('电压 V/v'); %db10小波进行4层分解 %一维小波分解 [c,l] = wavedec(xdata,4,'db10'); %重构第1-4层细节信号 d4 = wrcoef('d',c,l,'db10',4); d3 = wrcoef('d',c,l,'db10',3); d2 = wrcoef('d',c,l,'db10',2); d1 = wrcoef('d',c,l,'db10',1); %显示细节信号 figure(2) subplot(4,1,1); plot(d4,'LineWidth',2); ylabel('d4'); subplot(4,1,2); plot(d3,'LineWidth',2); ylabel('d3'); subplot(4,1,3); plot(d2,'LineWidth',2); ylabel('d2'); subplot(4,1,4); plot(d1,'LineWidth',2); ylabel('d1'); xlabel('样本序号 n/个'); %第1层细节信号的包络谱 y=hilbert(d1); ydata=abs(y); y=y-mean(y); nfft=1024; p=abs(fft(ydata,nfft)); figure(3); plot((0:nfft/2-1)/nfft*fs,p(1:nfft/2)); xlabel('频率 f/Hz'); ylabel('功率谱 P/W'); |
![]() |
![]() |