Revisión | 723a98687c3e1128cc9e752bcee7f36bbf504072 (tree) |
---|---|
Tiempo | 2007-08-05 22:42:44 |
Autor | iselllo |
Commiter | iselllo |
Now the code 3D_R_plotting.R calculates the distance (in a least-square
sense) between the fitting of the final state and the numerical result.
@@ -1,8 +1,8 @@ | ||
1 | 1 | rm(list=ls()) |
2 | 2 | library(lattice) |
3 | 3 | |
4 | -time_end<-50 #----end of time for the 3D plot | |
5 | -number_distr<-50 #---similar to above, but for the 2D plot. | |
4 | +time_end<-45 #----end of time for the 3D plot | |
5 | +number_distr<-46 #---similar to above, but for the 2D plot. | |
6 | 6 | |
7 | 7 | D_seq<-read.table("diameter_sequence",header=FALSE) |
8 | 8 | D_seq<-as.matrix(D_seq) |
@@ -169,11 +169,24 @@ | ||
169 | 169 | lines(D_mean,data_150[number_distr, ],lwd=2,col="brown") |
170 | 170 | |
171 | 171 | legend("topright",cex=1.2, c(expression("Initial"), expression("Experiment"),expression("Simulation")), |
172 | -lwd=c(2,2,2),lty=c(2,1,1),pch = c(-1,4,-1),col=c("black","blue", "brown"),box.lwd=0,box.lty=0 | |
172 | +lwd=c(2,2,2),lty=c(2,1,1),pch = c(-1,4,-1),col=c("black","blue", "brown"),box.lwd=0,box.lty=1 | |
173 | 173 | ,xjust = 1, yjust = 1) |
174 | 174 | |
175 | 175 | dev.off() |
176 | 176 | |
177 | +#Finally I estimate an error(sum of squares involving the numerical solution and the fitting of the final state): | |
178 | +final_fit<-read.table("dn_dlog_fin", header=FALSE) | |
179 | +final_fit<-as.matrix(final_fit) #to have the fitted population in cm^-3 | |
180 | + | |
181 | +my_error<-sum((final_fit-data_150[number_distr, ])^2) | |
182 | +my_error<-sqrt(my_error) | |
183 | +print('the difference (square root of sum of the squares) between the final numerical result and the fitting of the final state is') | |
184 | +print(my_error) | |
185 | +write.table(my_error,"lsq_error",col.names=FALSE,row.names=FALSE) | |
186 | +print("and the relative error is") | |
187 | +rel_error<-my_error/sum(final_fit) | |
188 | +print(rel_error) | |
189 | +write.table(rel_error,"relative_error",col.names=FALSE,row.names=FALSE) | |
177 | 190 | |
178 | 191 | |
179 | 192 | # 'merge = TRUE' for merging lines & points: |