-
Notifications
You must be signed in to change notification settings - Fork 0
/
z_simplexMain.m
77 lines (67 loc) · 1.56 KB
/
z_simplexMain.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
75
76
77
global numCallSimplex
global hB
global hS
global pB
global pS
N=3;
ki=zeros(N,1);
ui=zeros(N,1);
tao=zeros(N-1,1);
ki(1)=2.8;
ki(2)=sqrt(0.45);
ki(3)=sqrt(0.25);
ui(1)=1.1;
ui(2)=sqrt(0.33);
ui(3)=sqrt(0.16);
for i=1:N-1
tao(i)=10^(1-i);
end
%Creat ideal experimental data,
%xi are the parameters after fitting into
%polynomial series
xi=GetH(ki,ui,tao,N);
v1=0.0198;
v2=0.019802;
dt=0.1;
expB=xi(:,1);
expS=xi(:,2);
tt=zeros(1000,1);
hhB=zeros(1000,1);
hhS=zeros(1000,1);
for i=1:1000
tt(i)=dt*(i-1);
end
figure(1)
plot(tt,kmiu(tt,ki,tao,N),'-r',tt,kmiu(tt,ui,tao,N),'-b');
hold all
figure(2)
plot(hB,pB,'ob',hS,pS,'or');
hold all
%hhB and hhS are the created displacement for
%Berkovich and spherical indenters, respectively
for i=1:size(expB,1);
hhB=hhB+expB(i)*(v1.*tt).^(i-1);
hhS=hhS+expS(i)*(v2.*tt).^(i-1);
end
hhB(1)=0;
hhS(1)=0;
kk=zeros(6,1);
uu=zeros(6,1);
numCallSimplex = 0;
Nind =1;
options = optimset('Display','iter','MaxIter',10000,'MaxFunEvals',1000000,'TolFun',1e-10,'TolX',1e-10);
% [coeff,fval,exitflag] = fminsearch(@(coeff) Objective(hhB,hhS,coeff,tao,N,Nind),[1,1,1,1,1,1],optimset('MaxIter',10000,'MaxFunEvals',10000,'TolFun',1e-6))
[coeff,fval,exitflag] = fminsearch(@(coeff) Objective(hhB,hhS,coeff,tao,N,Nind),[1,1,1,1,1,1],options)
coeff=coeff';
kk=coeff(1:3,1);
uu=coeff(4:6,1);
figure(1);
kSim=kmiu(tt,kk,tao,N);
uSim=kmiu(tt,uu,tao,N);
plot(tt,kSim,'-r',tt,uSim,'-b');
hold all
xi=GetH(kk,uu,tao,N);
figure(2)
plot(hB,pB,'-r',hS,pS,'-b');
hold all
numCallSimplex