%% 清空环境
clc
clear
%%导入训练数据和测试数据
train = [3000 0.176 0.2 0.2 113.04;6000 0.181 0.2 0.2 226.08;9000 0.186 0.2 0.2 339.12;12000 0.193 0.2 0.2 452.16;
15000 0.198 0.2 0.2 565.2;18000 0.202 0.2 0.2 678.24;21000 0.208 0.2 0.2 791.28;24000 0.216 0.2 0.2 904.32;
22000 0.05 0.2 0.05 828.96;22000 0.15 0.2 0.15 828.96;22000 0.1 0.2 0.1 828.6 ;22000 0.2 0.2 0.2 828.96;
22000 0.25 0.2 0.25 828.96;22000 0.3 0.2 0.3 828.96;22000 0.35 0.2 0.35 828.96;22000 0.4 0.2 0.4 828.96;
22000 0.45 0.2 0.45 828.96];
train_out = [5.387 2.824 3.414 3.051 2.515 3.312 3.084 4.137 1.519 1.284 2.413 2.012 1.815 2.512 2.914 3.224 5.671];
test = [4500 0.179 0.2 0.2 169.56;7500 0.184 0.2 0.2 282.6;10500 0.189 0.2 0.2 395.64;13500 0.195 0.2 0.2 508.68;
16500 0.2 0.2 0.2 621.72;19500 0.205 0.2 0.2 734.76; 22500 0.212 0.2 0.2 847.8];
test_out = [3.8237 2.9526 3.3824 2.8132 2.1938 2.816 3.0887];
%%数据归一化
%%归一化方法1(利用libsvm工具箱函数归一化)
[train_data,test_data]=scaleForSVM(train,test,0,1)
[train_result,test_result,pstrain1]=scaleForSVM(train_out',test_out',0,1)
%%归一化方法2(利用svm自带mapminmax函数归一化)
%[train_data ,pstrain0] = mapminmax(train',0,1);
%[test_data] = mapminmax('apply',test',pstrain0);
%[train_result,pstrain1] = mapminmax(train_out,0,1);
%[test_result] = mapminmax('apply',test_out,pstrain1);
%train_data &