Interpolate both dataset on a same grid
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Jan
il 20 Mar 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...
Risposte (2)
Jan
il 20 Mar 2018
Modificato: Jan
il 20 Mar 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 Commento
Sophia
il 19 Mar 2018
Modificato: John D'Errico
il 20 Mar 2018
6 Commenti
Stephen23
il 20 Mar 2018
Modificato: Stephen23
il 20 Mar 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."
Vedere anche
Categorie
Scopri di più su Data Preprocessing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!