From: Tobias on 24 Feb 2010 08:45 Hi, I have got a question regarding TriScatteredInterp. I have got wind measuring stations containing latitude, longitude and average wind speed. I want to interpolate these measured wind speeds to the coordinates of a different wind farms. As the coordinates of the farms and stations a scattered I think I have to use TriScatteredInterp. The problem is that I have got about 20.000 wind speeds for every measuring station and I do not know how I can do the interpolation stepwise for all time steps. Give data: [station.lon]' = [1x27] [station.lat]' = [1x27] w_avg = [20.000x27] [farm.lat] = [1x15] [farm.lon] = [1x15] For just one wind speed data row, so for the speed at on specific time it works pretty fine. F = TriScatteredInterp([station.lon]',[station.lat]',b'); %b = w_avg(1000,:) [qx, qy] = meshgrid([farm.lon],[farm.lat]) w_avg_inter = F(qx, qy) Has anybody got an idea who I can program a loop to get w_avg_inter for all the 20.000 w_avg given?? Thanks!!
From: Ashish Uthama on 24 Feb 2010 09:40 On Wed, 24 Feb 2010 08:45:25 -0500, Tobias <tobias.aigner(a)elkraft.ntnu.no> wrote: > Hi, > > I have got a question regarding TriScatteredInterp. > > I have got wind measuring stations containing latitude, longitude and > average wind speed. I want to interpolate these measured wind speeds to > the coordinates of a different wind farms. As the coordinates of the > farms and stations a scattered I think I have to use > TriScatteredInterp. The problem is that I have got about 20.000 wind > speeds for every measuring station and I do not know how I can do the > interpolation stepwise for all time steps. > > Give data: > [station.lon]' = [1x27] > [station.lat]' = [1x27] > w_avg = [20.000x27] > [farm.lat] = [1x15] > [farm.lon] = [1x15] For just one wind speed data row, so for the speed > at on specific time it works pretty fine. > > F = TriScatteredInterp([station.lon]',[station.lat]',b'); %b = > w_avg(1000,:) > [qx, qy] = meshgrid([farm.lon],[farm.lat]) > w_avg_inter = F(qx, qy) > > Has anybody got an idea who I can program a loop to get w_avg_inter for > all the 20.000 w_avg given?? > > Thanks!! Since each row in w_avg will give you a 15x15 matrix(?), what do you think the dimensions of w_avg_inter ought to be? What do you want it to be for your further analysis? Cant you adapt this approach? (You would need to add another dimension to the output) http://www.mathworks.com/matlabcentral/newsreader/view_thread/274461#720596
From: Tobias on 24 Feb 2010 10:10 "Tobias " <tobias.aigner(a)elkraft.ntnu.no> wrote in message <hm3ahk$5fa$1(a)fred.mathworks.com>... > Hi, > > I have got a question regarding TriScatteredInterp. > > I have got wind measuring stations containing latitude, longitude and average wind speed. I want to interpolate these measured wind speeds to the coordinates of a different wind farms. As the coordinates of the farms and stations a scattered I think I have to use TriScatteredInterp. The problem is that I have got about 20.000 wind speeds for every measuring station and I do not know how I can do the interpolation stepwise for all time steps. > > Give data: > [station.lon]' = [1x27] > [station.lat]' = [1x27] > w_avg = [20.000x27] > [farm.lat] = [1x15] > [farm.lon] = [1x15] > > For just one wind speed data row, so for the speed at on specific time it works pretty fine. > > F = TriScatteredInterp([station.lon]',[station.lat]',b'); %b = w_avg(1000,:) > [qx, qy] = meshgrid([farm.lon],[farm.lat]) > w_avg_inter = F(qx, qy) > > Has anybody got an idea who I can program a loop to get w_avg_inter for all the 20.000 w_avg given?? > > Thanks!! The problem was the data handling. So- here is how it works. w_avg_int = zeros(length(farm),size(w_avg,1)); xx = struct2cell(station); xx = cell2mat(squeeze(xx(4:5,1,:))'); for i = 1:size(w_avg,1) F = TriScatteredInterp(xx(:,2),xx(:,1),(w_avg(i,:))'); w_avg_int(:,i) = F([farm.lon]',[farm.lat]'); end Thanks to Leiv!
From: Tobias on 24 Feb 2010 10:12 "Ashish Uthama" <first.last(a)mathworks.com> wrote in message <op.u8my1ejha5ziv5(a)uthamaa.dhcp.mathworks.com>... > On Wed, 24 Feb 2010 08:45:25 -0500, Tobias > <tobias.aigner(a)elkraft.ntnu.no> wrote: > > > Hi, > > > > I have got a question regarding TriScatteredInterp. > > > > I have got wind measuring stations containing latitude, longitude and > > average wind speed. I want to interpolate these measured wind speeds to > > the coordinates of a different wind farms. As the coordinates of the > > farms and stations a scattered I think I have to use > > TriScatteredInterp. The problem is that I have got about 20.000 wind > > speeds for every measuring station and I do not know how I can do the > > interpolation stepwise for all time steps. > > > > Give data: > > [station.lon]' = [1x27] > > [station.lat]' = [1x27] > > w_avg = [20.000x27] > > [farm.lat] = [1x15] > > [farm.lon] = [1x15] For just one wind speed data row, so for the speed > > at on specific time it works pretty fine. > > > > F = TriScatteredInterp([station.lon]',[station.lat]',b'); %b = > > w_avg(1000,:) > > [qx, qy] = meshgrid([farm.lon],[farm.lat]) > > w_avg_inter = F(qx, qy) > > > > Has anybody got an idea who I can program a loop to get w_avg_inter for > > all the 20.000 w_avg given?? > > > > Thanks!! > > Since each row in w_avg will give you a 15x15 matrix(?), what do you think > the dimensions of w_avg_inter ought to be? What do you want it to be for > your further analysis? > > Cant you adapt this approach? (You would need to add another dimension to > the output) > http://www.mathworks.com/matlabcentral/newsreader/view_thread/274461#720596 It was a problem with the data handling. w_avg_int = zeros(length(farm),size(w_avg,1)); xx = struct2cell(station); xx = cell2mat(squeeze(xx(4:5,1,:))'); for i = 1:size(w_avg,1) F = TriScatteredInterp(xx(:,2),xx(:,1),(w_avg(i,:))'); w_avg_int(:,i) = F([farm.lon]',[farm.lat]'); end Thanks to Leiv
From: Sujeet Phanse on 24 Feb 2010 14:39 > for i = 1:size(w_avg,1) > F = TriScatteredInterp(xx(:,2),xx(:,1),(w_avg(i,:))'); > w_avg_int(:,i) = F([farm.lon]',[farm.lat]'); > end Moreover, you can make the above loop better by avoiding the unnecessary triangulation step in each iteration. To do this, construct the TriScatteredInterp object only once outside the loop, and assign values to be interpolated into the object for each iteration before querying: F = TriScatteredInterp(xx(:,2),xx(:,1),zeros(size(w_avg,2),1)); for i = 1:size(w_avg,1) F.V = w_avg(i,:)'; w_avg_int(:,i) = F(farm.lon',farm.lat'); end
|
Pages: 1 Prev: help for nonlinear granger casuality test Next: Inverse for loop ? |