0001
0002
0003
0004
0005
0006
0007
0008 addpath(genpath('../../General-Functions/'));
0009 addpath('Functions')
0010
0011 close all
0012
0013
0014
0015
0016 init_rand = 6;
0017
0018
0019 type_robust = 0;
0020
0021
0022
0023
0024 out_C = 0;
0025
0026
0027
0028 print_type = 1;
0029 plot_type = 0;
0030
0031
0032
0033 ss = plot_init;
0034
0035
0036 init_rand_seed(init_rand);
0037
0038
0039
0040
0041 disp('----------------------------------------------------------------------------')
0042 disp('----- demo reconstruct dem from 7 points with flattening and smoothing -----')
0043 disp('----------------------------------------------------------------------------')
0044
0045
0046 dx=1/10;
0047
0048 display(['Grid size = ',num2str(dx)])
0049
0050
0051 disp(' ')
0052 disp('... for final plot take grid size dx=1/10 (may take a minute)')
0053 disp(' ')
0054
0055
0056
0057 [points,BB,delta_x,sigma_k,sigma_s,dem,out_in] = simulate_points_dem_0_flat(dx);
0058
0059
0060
0061 starttime_flattening = cputime;
0062 ds_flat = smooth_dem_robust_bilinear_flat...
0063 (points,BB,delta_x,sigma_k,out_C,type_robust,...
0064 print_type,plot_type);
0065
0066 disp([' time for solution flattening: ',num2str(cputime-starttime_flattening)])
0067
0068
0069 starttime_smoothing = cputime;
0070 ds_smooth = smooth_dem_robust_bilinear...
0071 (points,BB,delta_x,sigma_k,out_C,type_robust,...
0072 out_in,print_type,plot_type);
0073
0074 disp([' time for solution smoothing: ',num2str(cputime-starttime_smoothing)])
0075
0076
0077
0078 figure('name','Fig 16.9 bottom: Best fitting 2D function','color','w',...
0079 'Position',[0.1*ss(1),0.2*ss(2),0.8*ss(1),0.5*ss(2)]);
0080
0081 subplot(1,2,1);hold on;
0082 plot_surface(ds_flat,BB,delta_x,'EdgeColor','none','FaceLighting','gouraud',...
0083 'ColorFct','smoothtanh','shading','interp','alpha',0.3,'view',[-20,30]);
0084 plot3(points(:,1),points(:,2),points(:,3),'.b','MarkerSize',15);
0085 axis equal
0086 title('flat dem with given points','FontSize',16)
0087
0088 subplot(1,2,2);hold on
0089 plot_surface(ds_smooth,BB,delta_x,'EdgeColor','none','FaceLighting','gouraud',...
0090 'ColorFct','smoothtanh','shading','interp','alpha',0.3,'view',[-20,30]);
0091 plot3(points(:,1),points(:,2),points(:,3),'.b','MarkerSize',15)
0092 axis equal
0093 title('smooth dem with given points','FontSize',16)
0094
0095
0096