Feather and quiver not displaying data properly.

4 visualizaciones (últimos 30 días)
Steve
Steve el 7 de Abr. de 2013
Hi,
I have been having trouble using feather (and quiver) plots to display wind direction.
Basically I have hourly summaries of wind direction (0-360) and I am plotting them for each hour. I have them plotted but the arrows are not-corresponding to the proper position. i.e. an arrow pointing to north (0) is not pointing completely vertical as it should, and all angles appear to be off. I've tried many ways of manipulating to solve this issue but nothing has worked. I noticed compass plots have 0 along the x axis which might be related. But with compass you are able to use 'view' to change orientation...that does not appear to work for feather plots.
Here is my code at the moment:
winddirvector=numericvalues(:,7);
ffeather=figure;
p1=subplot(2,1,1);
theta=winddirvector*pi/180;
r=2*ones(size(winddirvector));
[u,v]=pol2cart(theta,r);
wdvp=feather(u,v);
I've tried changing wdvp to feather(sin(u), cos(u)) and it made the arrows point closer but still not accurate direction. I feel there are some math/geometry issues I am missing.
Any help is appreciated as a new MATLAB user.
  5 comentarios
Steve
Steve el 8 de Abr. de 2013
Sorry, I'm new to MATLAB but I've provided all the code I am working with.
The values for winddirvector are taken from a .txt file and then listed in a column, here is the code for that:
table_format='%s %s %f %f %f %f %f %f %f %f %f %f %f %f'; %Set table format for each column
file_id=fopen('DataFile.txt'); %open txt file for textscan rawdata=textscan(file_id, table_format,'MultipleDelimsAsOne',1,'Delimiter','\t','HeaderLines',1,'CollectOutput',1); %scan for text, remove header, set delimiter as tab, collect output fclose(file_id); convertdata=cellstr(rawdata{1,1});
numericvalues=(rawdata{1,2});
winddirvector=numericvalues(:,7);
No code other than that is being used to generate the values in winddirvector, so I'm not sure what else to say. The data is simply a column with 22 rows that have values ranging from 0-360. Thanks for taking the time to reply.
Steve
Steve el 8 de Abr. de 2013
To add...
Any values ranging from 0-360 would work, such as making a matrix with some arbitrary numbers, I just don't have code which generates these numbers.
Back to the issue, I want 0 to be pointing north and increasing in a clockwise manner to 360 (Back to 0), like a regular compass. The current way matlab treats it is that 0 is in the east direction and the values increase in a counter-clockwise fashion. This leads to north not being in the orientation I want it to be and the values increasing in the opposite direction. I have not found a way to solve this issue.
My only other thought is transforming the values (ie. making all 0 values into 90 so they point north, and change all the values so they display properly) but there must be a better way to transform the graph.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by