Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top