help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 3D plot from a matrix


From: Andy Buckle
Subject: Re: 3D plot from a matrix
Date: Mon, 19 May 2014 08:04:13 +0100




On 18 May 2014 15:47, guido.bonalumi <address@hidden> wrote:
Yes I think so, but I am not sure. I am trying to implement /quiver/ in my
code but I am having some troubles with the vectors /u/ and /v/.

Here is my code:

/X=[0, 6.8, 13.6, 20.4, 27.2, 34, 40.7, 47.5, 52.1, 56.6, 61.1, 65.6, 67.9];
X=X/(2*max(X));
Y=linspace(0,1,30);
Z=load("data.dat");
[XX YY]=meshgrid(X,Y);
save("-ascii", "matrix", '[XX YY]');
map=jet(256);
colormap (map);
surf(YY,XX,Z);
shading interp;

#title("Vista frontale");
xlabel("tg");
ylabel("rad");
colorbar("EastOutside");
view(2)
print -color perdite3D_vista_frontale.eps

#title("Vista in prospettiva");
xlabel("tg");
ylabel("rad");
zlabel("\\zeta");
colorbar("EastOutside");
view (25, 30);
print -color perdite3D.eps/

I am plotting a coefficient (Kinetic Energy Loss Coefficient) which is saved
in the file "data.dat" for each point defined by an couple of coordinates
(X, Y). For each point I know the three components of the Mach number and so
I created two matrix: one for the tangential coordinate and another one for
the radial (and saved them in two file: "tg.dat" and "rad.dat"). Then I
tried with this:
/
tg=("tg.dat");
rad=("rad.dat");
h=quiver(XX, YY, tg, rad);
set(h, "maxheadsize", 0.33);/

I have two problem:

- the result is not what I was expecting and it does not agree with my
vortex;
- /quiver/ create another graph while I want that these vectors show up in
my graph (the one that show the vortex), like two overlapping layers.

Any idea?


use "hold on" between plots to plot over previous.

surf is 3D. you might want something like contourf instead to go with quiver.

I think u,v are cartesian. are your tg,rad polar? you might need a conversion there.

--
/* andy buckle */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]