The CSV file with the data could be helpful to understand the problem, please share it.
Kriging prediction - pollution data
8 次查看(过去 30 天)
显示 更早的评论
good morning everyone!
I am working on a project to represent pollution values along a certain route.
I work on PM10 and CO (carbon monoxide) data, I use the kriging technique.
The graph I get for PM2.5 is fine, the problem is in the CO graph: when you plot the kriging predictions you should get the same kind of graph as for PM10 (so an extrapolation of the values), instead what I get are exactly the samples I collect along the route.
I put the two comparison plots and the code. If it helps I can also upload the csv with the data.
data_gps = load('C:\Users\alber\OneDrive\Desktop\TESI\PROVE_CAMPUS\3-03 (casa)\output_gga.csv');
latitudine = data_gps(:,1);
longitudine = data_gps(:,2);
altitudine = data_gps(:,3);
% converto le coord in coord locali
origine = [latitudine(1) longitudine(1) altitudine(1)];
[xEast, yNorth, zUp] = latlon2local(latitudine, longitudine, altitudine, origine);
% carico i dati del datalog
data_datalog = load('C:\Users\alber\OneDrive\Desktop\TESI\PROVE_CAMPUS\3-03 (casa)\DATALOG.csv');
%creo la griglia
[X, Y] = meshgrid(linspace(min(xEast), max(xEast), 166), linspace(min(yNorth), max(yNorth), 166));
%carico i dati del PM10
pm10 = data_datalog(:,4);
z = pm10;
n = length(data_datalog);
x = xEast;
y = yNorth;
subplot(2,2,1)
scatter(x, y, 10, z, 'filled'); axis image; axis xy
colorbar
title('track with pollution samples PM10')
v = variogram([x y], z, 'plotit', false, 'maxdist', 100);
% and fit a spherical variogram
subplot(2,2,2)
[dum,dum,dum,vstruct] = variogramfit(v.distance, v.val, [], [], [], 'model', 'stable');
xlabel('lag distance h [m]')
ylabel('\gamma(h) [\mug/m^3]')
title('variogram')
% now use the sampled locations in a kriging
[Zhat, Zvar] = kriging(vstruct, x, y, z, X, Y);
subplot(2,2,3)
imagesc(X(1,:),Y(:,1),Zhat); axis image; axis xy
% scatter(x, y,Zhat); axis image; axis xy
title('kriging predictions')
subplot(2,2,4)
contour(X, Y, Zvar); axis image
title('kriging variance')
%% ------------------------ KRIGGING CO ------------------------------
figure
co = data_datalog(:,1);
z = co;
% max_co = max(z);
subplot(2,2,1)
scatter(x, y, 10, z, 'filled'); axis image; axis xy
% geoscatter(lat,lon,10, z, 'filled')
% geobasemap openstreetmap
colorbar
title('track with pollution samples CO')
v = variogram([x y], z, 'plotit', false, 'maxdist', 100);
% and fit a spherical variogram
subplot(2,2,2)
[dum,dum,dum,vstruct] = variogramfit(v.distance, v.val, [], [], [], 'model', 'stable');
xlabel('lag distance h [m]')
ylabel('\gamma(h) [ppm]')
title('variogram')
% now use the sampled locations in a kriging
[Zhat, Zvar] = kriging(vstruct, x, y, z, X, Y);
subplot(2,2,3)
imagesc(X(1,:),Y(:,1),Zhat); axis image; axis xy
title('kriging predictions')
subplot(2,2,4)
contour(X, Y, Zvar); axis image
title('kriging variance')
Can anyone help me?
thank you very much,
alberto.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!