close

Вход

Забыли?

вход по аккаунту

?

Re: How to plot a quiver/direction field

код для вставки
Re: How to plot a quiver/direction field
Re: How to plot a quiver/direction field
Source: http://newsgroups.derkeiler.com/Archive/Comp/comp.softв€’sys.matlab/2010в€’08/msg04945.html
• From: "Sean " <sean.dewolski@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
• Date: Wed, 18 Aug 2010 13:58:37 +0000 (UTC)
"Niels " <niels.balens@xxxxxxxxxxxxxxxxx> wrote in message <i4fu4k$aqo$1@xxxxxxxxxxxxxxxxxx>...
"Sean " <sean.dewolski@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
<i4ea98$hvn$1@xxxxxxxxxxxxxxxxxx>...
> "Niels " <niels.balens@xxxxxxxxxxxxxxxxx> wrote in message
<i4djlv$13e$1@xxxxxxxxxxxxxxxxxx>...
> > Hello,
> > > > I'm looking for the best way to visualise some data. > > > > The data is that I have are
all different variables with the same setup. They are all matrices and every cell in the matrix
refers to a point in a certain area. All points are 1 meter separated from each other. So it's easy
for most of the variables to visualise them because I can use 'contour' or 'image' to plot them.
> > > > But one of the variables is a direction so it's a number in degrees (between 0В°в€’360В°)
and I can't seem to manage to visualise this one to my likings. I've tought about quiver or
streamslice or something like that but I can't get any usefull results... Anybody options how to
visualise this best?
> > > > Thank you,
> > Niels > > Can you provide a (small) sample of your data? It should be doable with
quiver() or maybe coneplot(). You'll just have to convert your angle to a [u v] displacement.
Good morning,
You can find a .mat в€’file here:
http://rapidshare.com/files/413615604/scPr_H5_NNW_dir.mat
Thank you for your interest,
Niels
I think this is what you want:
%%%%
%renamed your 'Dir' variable 'data' because dir is a builtin function.
%Indices of every point
[xx yy] = meshgrid(1:size(data,2),1:size(data,1));
%Table form for further computations
data = [xx(:), yy(:), data(:)];
Re: How to plot a quiver/direction field
1
Re: How to plot a quiver/direction field
%Get rid of all NaNs.
data(any(isnan(data),2),:) = [];
%Keep in table form, add u,v components of vector in the 4th,5th columns of
%data. u = cosd(theta),v = sind(theta); all vectors end on unit circle.
%Calculated with cartesian positive xв€’axis being theta = 0.
data = cat(2,data,cosd(data(:,3)),sind(data(:,3)));
%Plot it
quiver(data(:,1),data(:,2),data(:,4),data(:,5))
%SCd
.
Re: How to plot a quiver/direction field
2
Документ
Категория
Без категории
Просмотров
12
Размер файла
6 Кб
Теги
1/--страниц
Пожаловаться на содержимое документа