Attachment 'sheet07.m'
Download 1 function sheet07
2
3 %
4 % SINC DATA
5 %
6 figure(1)
7
8 % generate some data
9 [X, Y] = sincdata(100, 0.1);
10
11 % generate the kernel matrix
12 K = rbfkern(0.1, X);
13
14 % Run rde
15 [D, Yh] = rde(K, Y);
16
17 % plot the data
18 plot_fit(X, Y, Yh);
19 title(sprintf('sinc data set, effective dimensionality = %d', D));
20
21 %
22 % SINE DATA
23 %
24 figure(2)
25
26 % generate some data
27 [X, Y] = sinedata(100, 4, 0.1);
28
29 % generate the kernel matrix
30 K = rbfkern(0.1, X);
31
32 % Run rde
33 [D, Yh] = rde(K, Y);
34
35 % plot the data
36 plot_fit(X, Y, Yh);
37 title(sprintf('sine data set, effective dimensionality = %d', D));
38
39
40 function K = rbfkern(w, X)
41 N = size(X, 1);
42 XX = sum(X.*X, 2);
43 D = repmat(XX, 1, N) + repmat(XX', N, 1) - 2 * X * X';
44 K = exp(-D/(2*w));
45
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 %
48 % Insert your solutions below
49 %
50
51 function [X, Y] = sincdata(N, noise)
52 % ...
53
54 function [X, Y] = sinedata(N, K, noise)
55 % ...
56
57 function [D, Yh] = rde(K, Y)
58 % ...
59
60 function plot_fit(X, Y, Yh)
61 % ...
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.