0

My program creates 2D vector sheets that model wind data in a 3D space. I'd like to know how I can interpolate between those 2D sheets. X and Y values won't vary because they correspond to lat/long values that remain static. the W component of the vector is set to 0, leaving only the U/V components of the vector to be interpolated over a Z-range which corresponds to the Z-distance between two 2D vector sheets.

I've read into interp3, but I'm not sure it'll work with what I'm trying to do. If you can help at all with this, I'd be infinitely appreciative, thanks.

Note: I deleted a question that was similar to this that I previously asked because I believe I overcomplicated my question, thus dooming the potential for others to help answer it.

Thank you for your help, and let me know if I can provide any more information!enter image description here

Pierson Sargent
  • 175
  • 2
  • 18
  • 1
    Is it possible for you to provide a .mat file to the data being plotted as well as the code used to generate/plot the data? – Falimond Nov 24 '13 at 02:51
  • 1
    I apologize for my naive comment beforehand. I can create a .mat file in addition to the code, I think that you'll be able to do everything if you comment out the read_grib and mex-file unpack sections, but I'm new to ".mat" files, so I'm not sure! Let me know! **Thanks for inadvertently teaching me about ".mat" files :) Download via Dropbox: https://www.dropbox.com/s/5bgrwexesqm9a52/Code%26MATfile_WindSim.zip – Pierson Sargent Nov 24 '13 at 03:17
  • From the image you posted it seems like the final result and plot of interpolation would look like a wavy wall of arrows where the colored sheets shown above represent cross sections of this wavy wall for a certain value of Z? If this is correct then maybe interp3 isn't the function you're looking for, instead interp2 or interp1 might suffice seeing as your lat and long values are always fixed. Then for each long/lat coordinate you should just interpolate in one dimension (Z) with however many query points (equivalent to added cross-sections) you'd like. – Falimond Nov 24 '13 at 04:49

1 Answers1

1

Here's my code to interpolate for any number of different stations between two Z sheets. I believe it could be rewritten to include all Z sheets in the interp1() function. Hopefully this sets you in the right direction.

zLevels = 5;   %number of interpolated points between z50 and z75
nStation = 100;     %number of (lat,long) pairs to interpolate
for i = 1:nStation %for nStation different (lat, long) pairs generate interp. values
        % generate zQuery points between z50 and z75 for each station
        zQuery = ((1:zLevels)/zLevels)*range([z50mb_vec(i) z75mb_vec(i)]) + z75mb_vec(i);
        % use interp1 to interpolate about the Z axis for U component
        U(i,1:zLevels) = interp1([z50mb_vec(i) z75mb_vec(i)],[UwindVec50mb(i) UwindVec75mb(i)],zQuery);
        % and for V component
        V(i,1:zLevels) = interp1([z50mb_vec(i) z75mb_vec(i)],[VwindVec50mb(i) VwindVec75mb(i)],zQuery);
end

% defining some color codes for each zLevel, otherwise the plot is a mess
% of colors
colorcode = ['r' 'g' 'b' 'm' 'c' 'r' 'g' 'b' 'm' 'c' 'r'];
for j = 1:nStation
    for i = 1:zLevels
    quiver3(lat_value(j), long_value(j), zQuery(i), U(j,i), V(j,i), 0, colorcode(i));
    hold on;
    end
end

Generated plot (z50 data is in teal, z75 is in red, interpolated sheets otherwise): Plot from the above code

Falimond
  • 608
  • 4
  • 11