资源简介
希望有需要的同学喜欢,多交流信号处理的知识,代码共享
代码片段和文件信息
%~~~~~~~~~~~~~导入数据~~~~~~~~~~~~~%
clc
clear
Fs=71680;
N=Fs*5;
t=(0:N-1)/Fs;
Adc = 1; %直流分量幅度
% S=sin(2*pi*t.^2- pi/6)+sin(4*pi*t.^2- pi/6)+sin(8*pi*t.^2- pi/6)
% S2=Adc+ sin(2*pi* t.^2- pi/6);%参考轴的转速为n(t)=60t r/min
S=sin(2*pi*t.^2)+sin(4*pi*t.^2)+sin(8*pi*t.^2);
S2=Adc+ sin(2*pi* t.^2);
array_time_amp=S; %导入时域振动信号
pluse=S2; %导入脉冲信号
figure(1);
% subplot(211)plot(tarray_time_amp)title(‘time dominant振动信号时域图‘)xlabel(‘时间time‘)ylabel(‘幅值amplitude‘);
subplot(211)plot(tarray_time_amp)title(‘变转速数据‘)xlabel(‘时间time‘)ylabel(‘幅值amplitude‘);
grid on;
% subplot(212)plot(tpluse)title(‘keyphasor键相脉冲仿真信号时域图‘)xlabel(‘时间time‘)ylabel(‘幅值amplitude‘);
subplot(212)plot(tpluse)title(‘转速脉冲‘)xlabel(‘时间time‘)ylabel(‘幅值amplitude‘);
grid on;
% %~~~~~~~~~~~~~~~计算脉冲发生时刻~~~~~~~~~~~~~~~%
% Num_pluse1=1;
Num_pluse1=[];
Threshold=1.5;%设定脉冲阈值
for temp2=1:length(pluse)-1;%设temp2为步长为1的[12.....n-1]n-1维数组;即将所有的采样点编号;length函数功能是返回pluse的数组维数;for循环体循环n-1次,再结束。
% for temp2=1:length(pluse)-1;
if(pluse(temp2)<1.5&&pluse(temp2+1)>=1.5)
Num_pluse1=[ Num_pluse1temp2+1];%Num_pluse1=[121967.....temp(2+1)]
end
end
Num_pluse1=Num_pluse1(1:length(Num_pluse1));
if length(Num_pluse1)<2returnend;%如果脉冲信号就一个数则跳出计算脉冲发生时刻的函数
t_pluse=(Num_pluse1-1)/Fs;%
%
%
%
%
%~~~~~~~~~~~~~~~等角度时间计算~~~~~~~~~~~~~~~~%
delt_thet=pi/24;
t_angle=[];
for temp3=3:length(t_pluse);
b=inv([1t_pluse(temp3-2)t_pluse(temp3-2)^2;1t_pluse(temp3-1)t_pluse(temp3-1)^2;1t_pluse(temp3)t_pluse(temp3)^2])*[02*pi4*pi]‘;
if temp3==3;%(如果数temp3等于3则执行第一个循环,如果temp3不等于3则执行第二个循环,即在脉冲时刻[tt0tt3]执行第一个循环,等角度时刻记到[t1,t72])
k=0;
while k<1.5*2*pi/delt_thet;%0 tt=(sqrt(4*b(3)*(k*delt_thet-b(1))+b(2)^2)-b(2))/(2*(b(3)+eps));
t_angle=[t_anglett];
k=k+1;
end
else
k=pi/delt_thet;%k=24(如果temp3不等于3则执行第二个循环,即在脉冲时刻[tt1tt4].......[tt13tt16]执行第二个循环,等角度时刻记到[t72,t120],[t120t168]........[t648t696]))
while k>=pi/delt_thet && k<1.5*2*pi/delt_thet;% 24 tt=(sqrt(4*b(3)*(k*delt_thet-b(1))+b(2)^2)-b(2))/(2*(b(3)+eps));
t_angle=[t_anglett];
k=k+1;
end
end
end
a
相关资源
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
- k近邻算法matlab实现
评论
共有 条评论