Interpolate both dataset on a same grid
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, i have the two different datasets (PFA the excel file) as following
Dataset A size (119*177) with each lat and long file of same size
Dataset B size (145*73) with long size of (145*1) and lat size of (73*1)
The steps according to my understanding are-
- Make a lat, long file for dataset B of size (145*73) - question how to do that?
- Interpolate the dataset A to the size of Dataset B, which i am guessing using interp2
5 comentarios
Jan
el 20 de Mzo. de 2018
An abbreviation for the first part:
nlong = repmat(lat, mm, 1);
nlat = repmat(long(:), 1, nn);
But you do not need to create matrices with the grid coordinates, because interp2 accepts vectors directly.
See my answer...
Respuestas (2)
Jan
el 20 de Mzo. de 2018
Editada: Jan
el 20 de Mzo. de 2018
I assume that this helps:
B = rand(145, 73);
A = rand(119, 177);
y = linspace(1, 145, 199);
x = linspace(1, 73, 177);
BB = interp2(1:73, (1:145).', B, x, y.');
Now BB is the linear interpolation of B with the same size as A.
Note: I still find the order of the coordinates for interp2 counter-intuitive:
Vq = interp2(V,Xq,Yq) assumes X=1:N and Y=1:M where [M,N]=SIZE(V)
I'd expect the 1st input to be correlated to size(V, 1) and the 2nd to size(V,2), but MathWorks decided to swap the order. This is at least consistent with e.g. gradient.
1 comentario
Sophia
el 19 de Mzo. de 2018
Editada: John D'Errico
el 20 de Mzo. de 2018
6 comentarios
Stephen23
el 20 de Mzo. de 2018
Editada: Stephen23
el 20 de Mzo. de 2018
"Offering a programming service in a Matlab forum is not completely off-topic"
1.e "You agree ... nor to use the communication systems provided by the Site (e.g., comments) for any commercial solicitation purposes."
2.a.iv "You may not use the Site to sell or market your products or services to others."
Ver también
Categorías
Más información sobre Data Preprocessing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!