How can I reshape the data to plot vorticity?

5 vues (au cours des 30 derniers jours)
tethys
tethys le 25 Fév 2016
Commenté : tethys le 11 Mar 2016
I have a data consisting of x, y coordinates, along with swirl strength value in each of these coordinates. What would be the correct way to reshape the data into matrix format so that I can use pcolor command for plotting colormap? I have the following code, but I am not really sure how to continue for the w value at these points. The data is attached. Thanks a lot!
x = data(:,1); y = data(:,2); w = data(:,3);
xu=unique(x); yu=unique(y);
x_new=(xu*ones(1,length(unique(yu)))).';
y_new=(yu*ones(1,length(unique(xu))));

Réponse acceptée

Honglei Chen
Honglei Chen le 25 Fév 2016
From your data, you may want to do
y_new = reshape(x,numel(xu),numel(yu));
x_new = reshape(y,numel(xu),numel(yu));
pcolor(x_new,y_new,reshape(w,numel(xu),numel(yu)));
  1 commentaire
tethys
tethys le 11 Mar 2016
Thanks a lot! It worked well.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by