
smooth-Vondrak
Publicado por marta (19 intervenciones) el 22/09/2015 13:03:22
Buenas, estaba intentando hacer un estudio sobre el vondrak y que valor es el más idóneo de eps1, pero me da un error que no entiendo mira:
--El error que me devuelve es este: Error in smooth1 (line 13)
d = 0;
Output argument "dy1" (and maybe others) not assigned during call to "/Users/Chewaka/Desktop/Datos
observatorio/smooth1.m>smooth1".
Error in pruebasmooth1 (line 6)
[y1,sd,err]=smooth1(n,eps1,x,y,w)
Lo he probado con datos aleatorio y funciona así que es algo de los datos que yo no veo. He adjuntado los archivos que uso por si os sirven de algo
Gracias, aqui os dejo el script:
--El error que me devuelve es este: Error in smooth1 (line 13)
d = 0;
Output argument "dy1" (and maybe others) not assigned during call to "/Users/Chewaka/Desktop/Datos
observatorio/smooth1.m>smooth1".
Error in pruebasmooth1 (line 6)
[y1,sd,err]=smooth1(n,eps1,x,y,w)
Lo he probado con datos aleatorio y funciona así que es algo de los datos que yo no veo. He adjuntado los archivos que uso por si os sirven de algo
Gracias, aqui os dejo el script:
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
y=A';
x=ppp1' ;
n=length(x);
w=ones(1,n);
eps1=1e+12;
function [dy1,sd,err]=smooth1(n,eps1,dx,dy,w)
%c input n(i4) number of points;
% c input eps1(r4) degree of smoothing;<<<------ ese es el valor que quiero estudiar
%c input dx(r8) arguments;
% function [valuesResult]=values(varargin);
% valuesResult=[];
% c output sd(r4) standard deviation;
% c output err(l4) indication of rough error;
% c(c) j. vondrak, june 1999;
% if isempty(d), d=0; end;
d = 0;
% if isempty(w), w=(ones(1,:)); end;
%if isempty(dy), dy=(ones(1,:)); end;
%f isempty(dy1), dy1=(ones(1,:)); end;
%if isempty(da), da=(ones(7000,4)); end;
%if isempty(db), db=(ones(1,4)); end;
%if isempty(dp), dp=(ones(4,4)); end;
%if isempty(err), err=false; end;
da = (ones(7000,4));
db=(ones(1,4));
dp=(ones(4,4));
err=false;
function dpar=dpar(dxx), dpar=dp1+dxx.*(dp2+dxx.*dp3); end
if(n>7000 || n<3),return, end;
% estimation of parabolic fit;
dxo=(.5.*(dx(1)+dx(n))); % fijando baricentro
dp=(zeros(4,4));
db=(ones(1,4));
for i=1:n; % las siguientes sentencias aplican baricentro y preparan calculo de
dxi=dx(i)-dxo; % y sombrero, ec. 11 del paper.
dy1(i)=0; % inicializa dy1 de i.
db(2)=dxi;
db(3)=dxi.*dxi;
db(4)=dy(i); % valor observado en instante i.
for j=1:3;
for k=1:4;
dp(j,k)=dp(j,k)+w(i).*db(j).*db(k);
end;
end;
end;
for j=1:3;
dp1=dp(1,j);
for k=j+1:4;
dp2=dp(1,k);
for i=1:2;
dp(i,k)=dp(i+1,k)-dp(i+1,j).*dp2./dp1;
end;
dp(3,k)=dp2./dp1;
end;
end;
dp1=dp(1,4);
dp2=dp(2,4);
dp3=dp(3,4);
% Parece que definitivamente los valores dp(i,j) son coef. de las ec. al
% aplicar rms.
if(eps1==0.), return, end %goto 10;
% end;
% forming the equations;
da=zeros(7000,4);
o=eps1./(n-3);
for i=1:n;
da(i,1)=o.*w(i);
dy1(i)=da(i,1).*(dy(i)-dpar(dx(i)-dxo)); % dy1
end;
ddx=dx(n)-dx(1); % amplitud o rango de la variable independiente
for i=1:n-3;
ds=36.*(dx(i+2)-dx(i+1))./ddx; % numerador de a, b, c y d escalado.
for j=1:4;
db(j)=1d0;
for k=1:4;
if(k~=j)
db(j)=db(j)./(dx(i+j-1)-dx(i+k-1));
end;
end;
end;
for j=1:4;
for k=j:4;
da(i+j-1,k-j+1)=da(i+j-1,k-j+1)+ds.*db(j).*db(k);
end;
end;
end;
% solution of the equations;
% initialization of array dp;
for j=1:3;
for k=1:j;
dp(j,k)=da(k,j-k+2);
end;
end;
% reduction of matrix da to an upper triangular matrix;
for i=1:n-1;
n3=min([3,n-i]);
dy1(i)=dy1(i)./da(i,1);
for j=2:n3+1;
da(i,j)=da(i,j)./da(i,1);
end;
for j=1:n3;
dy1(i+j)=dy1(i+j)-dy1(i).*dp(j,1);
for k=1:n3-j+1;
da(i+j,k)=da(i+j,k)-da(i,k+j).*dp(j,1);
end;
end;
dp(1,1)=dp(2,2)-da(i,2).*dp(2,1);
dp(2,1)=dp(3,2)-da(i,2).*dp(3,1);
dp(2,2)=dp(3,3)-da(i,3).*dp(3,1);
dp(3,1)=da(i+1,4);
if(i<=n-2)
dp(3,2)=da(i+2,3);
end;
if(i<=n-3)
dp(3,3)=da(i+3,2);
end;
end;
% calculation of the unknowns;
dy1(n)=dy1(n)./da(n,1);
for i=1:n-1;
k=n-i+1;
n3=min([3,n-i]);
for j=1:n3;
dy1(k-j)=dy1(k-j)-da(k-j,j+1).*dy1(k);
end;
end;
% estimation of sigma, detection of rough errors;
sd=0.;
for i=1:n;
dy1(i)=dy1(i)+dpar(dx(i)-dxo);
sd=sd+w(i).*(dy1(i)-dy(i)).^2;
end;
if(n<=3), return, end,
sd=sqrt(sd./(n-3));
err=false;
for i=1:n;
if(sqrt(w(i)).*abs(dy1(i)-dy(i))>3.5.*sd)
err=true;
end;
end;
return;
end
- Archivo-comprimido-2.zip(144,0 KB)
Valora esta pregunta


0