-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathANN-Marker.m
74 lines (57 loc) · 1.24 KB
/
ANN-Marker.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
clc
clear all
%****************************%
%****************************%
%****************************%
[Model_CMC,PathName] = uigetfile('*.m','Select path for the main program:');
addname='flat';
filepath=strcat(PathName,addname);
%文件中只有txt文件才行
file_structure = dir(filepath);
MAT=size(file_structure);
N=MAT(1);
STR=cell(N-2,1);
% mkdir normalizedata
% ProcessData='normalizedata';
% fileoutpath=strcat(PathName,ProcessData);
for i=3:N
filename = file_structure(i).name; % stract 连接字符串
STR{i-2,1}=filename(1:end-4);
STR{i-2,1}=strcat(STR{i-2,1});
end
[NN,mm]=size(cellstr(STR));
input=[];
output=[];
for i=1:NN
file=char(STR(i));
filetype='.xls';
filename=strcat(file,filetype);
cd (filepath)
Da=xlsread(filename,1);
a=Da(:,1:6);
b=Da(:,16:20);
[M,N]=size(a);
input=[input;a];
output=[output;b];
% NUM2(:,j-1)=A;
end
input11=input';
output22=output';
input111=input11(:,1:101);
output111=output22(1,1:101);
% a=1:1:3131;
% plot(a,output22);
% hold on
% plot(a,output11111);
% ANN
net = fitnet(10,'trainbr');
view(net)
net = train(net,input11,output22);
save net
P=input11(:,1:101);
R=output22(1,1:101);
A=sim(net,P)
figure(1)
plot(A','b');
hold on
plot(R,'r')