Effacer les filtres
Effacer les filtres

plot field form a orderd vector

2 vues (au cours des 30 derniers jours)
giacomo labbri
giacomo labbri le 12 Jan 2021
Commenté : giacomo labbri le 13 Jan 2021
Hi,
I need some help to plot the output of a model. I am trying to plot a 3D wind filed and this is what I have (this is just a minimal working example):
lat=[10,11,10,12,13,10]
lon=[50,51,52,54,52,51]
height=[10,50,120]
wind_speed=[7,4,3,2,1,6 ; 8,6,5,4,5,9; 10,8,8,7,6,11]
wind_direction=[120,110,150,115,117,113; 122,113,154,118,119,115; 126,117,159,121,120,117]
What I would like to have is a 3D map with arrows indicatin the direction and intensity of the wind at height and lat lon position established by the vectors lat lon height. A maybe simpler intermidiate step could be plot just a 2d plot correspoding to a specific height.
The problem is with the localization with lat lon. The position in the vector (or in the comlun for wind speed and direction) idetify correspoding values. This is to say that the column of wind speed values
wind_speed(:,2)
must be plotted in positions that are stored in lat(2) e lon(2)
This is clear to me . I just don't know how to "expalin" it to matlab XD.
I hope I maaged to expaine my problem! Any help is appriciated!
Giacomo

Réponses (1)

Walter Roberson
Walter Roberson le 12 Jan 2021
lat=[10,11,10,12,13,10]
lat = 1×6
10 11 10 12 13 10
lon=[50,51,52,54,52,51]
lon = 1×6
50 51 52 54 52 51
height=[10,50,120]
height = 1×3
10 50 120
wind_speed=[7,4,3,2,1,6 ; 8,6,5,4,5,9; 10,8,8,7,6,11]
wind_speed = 3×6
7 4 3 2 1 6 8 6 5 4 5 9 10 8 8 7 6 11
wind_direction=[120,110,150,115,117,113; 122,113,154,118,119,115; 126,117,159,121,120,117]
wind_direction = 3×6
120 110 150 115 117 113 122 113 154 118 119 115 126 117 159 121 120 117
latin = repmat(lat, length(height), 1);
lonin = repmat(lon, length(height), 1);
hin = repmat(height(:), 1, length(lat));
%probe positions
platvec = min(lat):max(lat);
plonvec = min(lon):max(lon);
pheightvec = height;
[latG, lonG, hG] = meshgrid(platvec, plonvec, pheightvec);
S = scatteredInterpolant(latin(:), lonin(:), hin(:), wind_speed(:));
SG = S(latG, lonG, hG);
D = scatteredInterpolant(latin(:), lonin(:), hin(:), wind_direction(:));
DG = D(latG, lonG, hG);
WG = zeros(size(DG));
quiver3(latG, lonG, hG, SG, DG, WG);
  2 commentaires
giacomo labbri
giacomo labbri le 13 Jan 2021
Thanks for the answer! I tried to apply it to the real data but I run out of memory at the repeatmat. Do you have any suggestion how to work around this problem?
giacomo labbri
giacomo labbri le 13 Jan 2021
Would it be simpler to do a contour plot of just one height? I tried but I didn't manage to? any advice?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by