当前位置:网站首页>【微弱瞬态信号检测】混沌背景下微弱瞬态信号的SVM检测方法的matlab仿真
【微弱瞬态信号检测】混沌背景下微弱瞬态信号的SVM检测方法的matlab仿真
2022-06-13 06:40:00 【fpga和matlab】
1.软件版本
matlab2015b
2.算法仿真概述
在研究算法性能之前,首先需要分析各个参数对算法整体性能的影响,本文将重点考虑相空间重构参数tao和m,SVM支持向量机参数C和。这里分别对四个参数进行性能影响测试,首先对延迟参数进行分析,其仿真结果如下所示:
从图的仿真结果可知,随着延迟时间的增加,系统性能基本上呈现逐渐降低。但是当延迟时间大于5的时候,性能性能又出现了一定程度的提升。因此,该参数和性能性能并不是线性变化的关系。
从图2的仿真结果可知,随着嵌入维数的增加,系统性能基本上呈现逐渐提升。但当嵌入维数大于3的时候,系统的性能基本保持平稳状态。
从图3的仿真结果可知,随着惩罚因子的增加,系统的性能在出现一次提升之后,当惩罚因子大于50的时候,性能基本保持不变。
从图4的仿真结果可知,随着核函数参数的增加,系统的性能在出现了逐渐的提升,随着核函数参数的不断增加,系统性能提升逐渐变缓。
从上面对四个参数的对比仿真分析可知,四个参数对系统性能影响并不是满足线性关系的,四个参数相互之间有着一定程度的相关性,因此,采用传统的单个参数分析的方法并不能获得最优的参数设置。针对这个问题,本文将分别提出一种基于PSO优化参数和SVM的预测方法以及一种基于GA+PSO改进优化算法和SVM的预测方法。
首先,对于SVM算法的预测效果进行测试,通过人工任意设置四个参数(2,3,300.9962,2.93),并在481点到520点加入一个幅度为0.0004的随机的瞬间信号,然后使用SVM算法进行预测,其仿真结果如下图所示:
从图5的仿真结果可知,预测误差的整体RMSE值在10的-3次左右,在不考虑参数优化的情况下,通过任意设置参数的方式,其预测结果较差,上图仿真结果中,200点,780点均出现了错误的检测结果,从而因此错误预测。由此可见,通过参数优化对预测效果的提升有着决定性的作用。
从图6的仿真结果可知,预测误差的整体RMSE值在10的-4次左右,且改善了部分区域干扰的影响,上图中,200点的干扰信号已经小于481点和520点的幅度,在481点到520点的区域出现了较大的幅度,说明瞬时微弱信号的存在,总体而言,通过PSO优化之后,系统的预测性能得到了明显的改善。
3.部分源码
clc;
clear;
close all;
warning off;
addpath 'func\'
addpath 'GA_toolbox\'
addpath 'func_SVM_toolbox\'
addpath 'func_SVM_toolbox\java\'
addpath 'func_SVM_toolbox\java\libsvm\'
addpath 'func_SVM_toolbox\matlab\'
addpath 'func_SVM_toolbox\matlab-implement[by faruto]\'
addpath 'func_SVM_toolbox\python\'
addpath 'func_SVM_toolbox\svm-toy\'
addpath 'func_SVM_toolbox\tools\'
addpath 'func_SVM_toolbox\windows\'
%作为对比,直接通过SVM算法,没有通过优化算法直接进行算法的仿真;
rng(1);
%先进行优化,设置1,然后设置2,调用优化值进行测试
SEL = 2;
%导入数据
load 训练\X_train.mat;
load 测试\X_test.mat;
X_train0 = X_train;
X_test0 = X_test;
figure;
plot(X_test0);
xlabel('样本点n');
ylabel('幅值');
[y1,input1ps] = mapminmax(X_train0');
[y2,input2ps] = mapminmax(X_test0');
X_train = y1';
X_test = y2';
if SEL == 1
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%通过GA-PSO搜索最优的四个参数
%tao的范围
min1 = 1;
max1 = 10;
%m的范围
min2 = 1;
max2 = 10;
%C的范围
min3 = 1;
max3 = 1000;
%gamma的范围
min4 = 0;
max4 = 5;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wmax = 0.9;
wmin = 0.1;
c1 = 2.5;
c2 = 2.5;
%速度的范围
vmin =-7;
vmax = 7;
MAXGEN = 50;
NIND = 10;
Chrom = crtbp(NIND,4*10);
%变量的区间
Areas = [min1,min2,min3,min4;
max1,max2,max3,max4];
FieldD = [rep([10],[1,4]);Areas;rep([0;0;0;0],[1,4])];
Data1 = zeros(NIND,4);
gen = 0;
for a=1:1:NIND
%保证每个数值不一样,
Data1(a,:) = [1,1,1000,0.3];
tao = Data1(a,1);
m = Data1(a,2);
C = Data1(a,3);
gamma = Data1(a,4);
%计算对应的目标值
[epls,tao,m,C,gamma] = func_fitness(X_train,X_test,tao,m,C,gamma);
E = epls;
J(a,1) = E;
va(a) =(vmax-vmin)*rand(1)+vmin;
vb(a) =(vmax-vmin)*rand(1)+vmin;
vc(a) =(vmax-vmin)*rand(1)+vmin;
vd(a) =(vmax-vmin)*rand(1)+vmin;
end
[V,I] = min(J);
JI = I;
tmpps = Data1(JI,:);
taos = round(tmpps(1));
ms = round(tmpps(2));
Cs = tmpps(3);
gammas = tmpps(4);
Objv = (J+eps);
gen = 0;
while gen < MAXGEN;
gen
w = wmax-gen*(wmax-wmin)/MAXGEN;
FitnV = ranking(Objv);
Selch = select('sus',Chrom,FitnV);
Selch = recombin('xovsp',Selch,0.9);
Selch = mut(Selch,0.1);
phen1 = bs2rv(Selch,FieldD);
%基于粒子群的速度更新
for i=1:1:NIND
if gen > 1
va(i) = w*va(i) + c1*rand(1)*(phen1(i,1)-taos2) + c2*rand(1)*(taos-taos2);
vb(i) = w*vb(i) + c1*rand(1)*(phen1(i,2)-ms2) + c2*rand(1)*(ms-ms2);
vc(i) = w*vc(i) + c1*rand(1)*(phen1(i,3)-Cs2) + c2*rand(1)*(Cs-Cs2);
vd(i) = w*vd(i) + c1*rand(1)*(phen1(i,4)-gammas2) + c2*rand(1)*(gammas-gammas2);
else
va(i) = 0;
vb(i) = 0;
vc(i) = 0;
vd(i) = 0;
end
end
for a=1:1:NIND
Data1(a,:) = phen1(a,:);
tao = round(Data1(a,1) + 0.15*va(i));%遗传+PSO
m = round(Data1(a,2) + 0.15*vb(i));
C = Data1(a,3) + 0.15*vc(i);
gamma = Data1(a,4) + 0.15*vd(i);
if tao >= max1
tao = max1;
end
if tao <= min1
tao = min1;
end
if m >= max2
m = max2;
end
if m <= min2
m = min2;
end
if C >= max3
C = max3;
end
if C <= min3
C = min3;
end
if gamma >= max4
gamma = max4;
end
if gamma <= min4
gamma = min4;
end
%计算对应的目标值
[epls,tao,m,C,gamma] = func_fitness(X_train,X_test,tao,m,C,gamma);
E = epls;
JJ(a,1) = E;
end
Objvsel=(JJ);
[Chrom,Objv]=reins(Chrom,Selch,1,1,Objv,Objvsel);
gen=gen+1;
%保存参数收敛过程和误差收敛过程以及函数值拟合结论
Error(gen) = mean(JJ);
pause(0.2);
[V,I] = min(Objvsel);
JI = I;
tmpps = Data1(JI,:);
taos2 = round(tmpps(1));
ms2 = round(tmpps(2));
Cs2 = tmpps(3);
gammas2 = tmpps(4);
end
[V,I] = min(Objvsel);
JI = I;
tmpps = Data1(JI,:);
tao0 = round(tmpps(1));
m0 = round(tmpps(2));
C0 = tmpps(3);
gamma0 = tmpps(4);
save GAPSO.mat tao0 m0 C0 gamma0
end
if SEL == 2
load GAPSO.mat
%调用四个最优的参数
tao = tao0;
m = m0;
C = C0;
gamma = gamma0;
%先进行相空间重构
[Xn ,dn ] = func_CC(X_train,tao,m);
[Xn1,dn1] = func_CC(X_test,tao,m);
t = 1/1:1/1:length(dn1)/1;
f = 0.05;
sn = 0.0002*sin(2*pi*f*t);
%叠加
dn1 = dn1 + sn';
%SVM训练%做单步预测
cmd = ['-s 3',' -t 2',[' -c ', num2str(C)],[' -g ',num2str(gamma)],' -p 0.000001'];
model = svmtrain(dn,Xn,cmd);
%SVM预测
[Predict1,error1] = svmpredict(dn1,Xn1,model);
RMSE = sqrt(sum((dn1-Predict1).^2)/length(Predict1));
Err = dn1-Predict1;
%误差获取
clc;
RMSE
figure;
plot(Err,'b');
title('混沌背景信号的预测误差');
xlabel('样本点n');
ylabel('误差幅值');
Fs = 1;
y = fftshift(abs(fft(Err)));
N = length(y)
fc = [-N/2+1:N/2]/N*Fs;
figure;
plot(fc(N/2+2:N),y(N/2+2:N));
xlabel('归一化频率');
ylabel('频谱');
text(0.06,0.07,'f=0.05Hz');
end
4.参考文献
[1]郑红利. 基于相空间重构的混沌背景下微弱信号检测方法研究[D]. 南京信息工程大学, 2015.A07-06
边栏推荐
- Detailed explanation of the player network data reading process of ijkplayer code walkthrough 2
- 10 Honest Facts I Want To Share With All Junior Developers
- If the key in redis data is in Chinese
- Ijkplayer code walkthrough player network video data reading process details
- Ijkplayer code walk through read_ AV in thread thread_ read_ Detailed explanation of frame() data stream reading process
- 'ipconfig' is not an internal or external command, nor is it a runnable program or batch file.
- 【虚拟机】 VMware虚拟机占用空间过大解决
- Kotlin collaboration - simple use of collaboration
- Unable to find method 'org gradle. api. artifacts. result. ComponentSelectionReason. getDesc
- 机器学习笔记 - 监督学习备忘清单
猜你喜欢
Data storage in memory (C language)
Notepad++ settings delete current line shortcut
Do you want to carry out rapid steel mesh design and ensure the quality of steel mesh? Look here
上位机开发(固件下载软件之详细设计)
MFS details (VII) -- MFS client and web monitoring installation configuration
How to quickly support the team leader to attract new fission users in the business marketing mode of group rebate?
【虚拟机】 VMware虚拟机占用空间过大解决
[SketchUp 2021] CAD file import and modeling in the sketch master (establish elevation model in the sketch master by using CAD drawings), and the sketch master exports 2D, 3D and elevation effects of
JetPack - - - DataBinding
16、 IO stream (II)
随机推荐
景联文科技提供语音数据采集标注服务
Scrcpy development environment construction and source code reading
Two uses of bottomsheetbehavior
Use of kotlin basic common sets list, set and map
Unable to find method 'org gradle. api. artifacts. result. ComponentSelectionReason. getDesc
【Kernel】驱动编译的两种方式:编译成模块、编译进内核(使用杂项设备驱动模板)
如何使用望友DFM软件进行冷板分析
Project analysis of Taishan crowdfunding mode: why is Taishan crowdfunding mode so popular?
The processing and application of C language to documents
Will the chain 2+1 model be a new business outlet and a popular Internet e-commerce market?
Unable to locate program input point getrawinputdevicelist in dynamic link library user32 DLL processing
Why is the blind box e-commerce mode so popular?
如何使用望友DFM軟件進行冷板分析
面试必刷算法TOP101之单调栈 TOP31
How to seize the bonus of social e-commerce through brand play to achieve growth and profit?
Scrcpy source code walk 2 how to connect a client to a mobile server
Array operations in JS
YOLOv5解析 | 参数与性能指标
Cocos creator compilation game cannot read property 'polygonpolygon' of undefined
vue3路由缓存组件状态以及设置转场动画