-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUntitled11.m
More file actions
62 lines (53 loc) · 886 Bytes
/
Untitled11.m
File metadata and controls
62 lines (53 loc) · 886 Bytes
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
%RBF MODELLEME
clear all
close all
clc
t=[-10:1.45:8.85]';
y=[0.2297
0.2762
0.2254
0.2239
0.0991
0.3313
0.9591
1.2017
0.6974
0.1354
-0.0524
0.0257
0.4170
0.1296];
noise = 0.0*randn(length(y),1); %buradaki katsayý gürültü katsayýsýdýr
y=y+noise;
tmin=min(t);
tmax=max(t);
n=6; %polinomun derecesiyle oynar
N=size(t,1); %data sayýmýz
c(1)=tmin+(tmax-tmin)/(2*n);
for k=2:n
c(k) =c(k-1)+(tmax-tmin)/(n);
end
sigma= (tmax-tmin)/(n);
J=[];
for i=1:N
for j=1:n
J(i,j)= -exp(-(t(i)-c(j))^2/(sigma)^2); % sayfa 67 deki formül
end
end
x=-inv(J'*J)*J'*y %kitapta 64.sayfadaki x^* formülü
yhat=-J*x;
e=y-yhat;
F=e'*e;
x=rand(n,1);
for k=1:4566 % k deðerinin deðiþmesiyle kalite artar
yhat= -J*x;
e=y-yhat;
F=e'*e;
p=-2*J'*e;
s=0.0001;
x=x+s*p;
disp(F)
end
plot(t,y,'b*')
hold on
plot(t,yhat,'r')