From: Ana on
Hi guys,

Anyone knows how can one extract vectors of a 3D plot? Thanks alot. Would really appreciate any hints.

Ana
From: Walter Roberson on
Ana wrote:

> Anyone knows how can one extract vectors of a 3D plot? Thanks alot.
> Would really appreciate any hints.

It isn't clear what you mean by 'vectors', and it isn't clear what kind of 3D
plot you have.

If you have something that has been produced by plot3(), then

PlotHandle = plot3(X,Y,Z);

PlotX = get(PlotHandle,'XData');
PlotY = get(PlotHandle,'YData');
PlotZ = get(plotHandle, 'ZData');


For a surf you can do the same sort of thing, getting the XData, YData, ZData,
and you can also get VertexNormals, which is length(x) x length(y) x 3

The surfaceplot properties documentation says of this:

"This property contains the vertex normals for the surfaceplot. MATLAB
generates this data to perform lighting calculations. You can supply your own
vertex normal data, even if it does not match the coordinate data. This can be
useful to produce interesting lighting effects."


patch objects also have the VertexNormals property
From: Ana on
Hi,

By 3D plot I mean for instance you have a plot having :

Z = exp(-s*t) where s = 0.25 + j

When plotting with feather(Z), You get a spiral and these show the vectors that are rotating. Therefore can one obtain, their magnitude and angle (phase) ?

Thanks alot for your time. Truly appreciate.

Ana





Walter Roberson <roberson(a)hushmail.com> wrote in message <hlup2j$mvq$1(a)canopus.cc.umanitoba.ca>...
> Ana wrote:
>
> > Anyone knows how can one extract vectors of a 3D plot? Thanks alot.
> > Would really appreciate any hints.
>
> It isn't clear what you mean by 'vectors', and it isn't clear what kind of 3D
> plot you have.
>
> If you have something that has been produced by plot3(), then
>
> PlotHandle = plot3(X,Y,Z);
>
> PlotX = get(PlotHandle,'XData');
> PlotY = get(PlotHandle,'YData');
> PlotZ = get(plotHandle, 'ZData');
>
>
> For a surf you can do the same sort of thing, getting the XData, YData, ZData,
> and you can also get VertexNormals, which is length(x) x length(y) x 3
>
> The surfaceplot properties documentation says of this:
>
> "This property contains the vertex normals for the surfaceplot. MATLAB
> generates this data to perform lighting calculations. You can supply your own
> vertex normal data, even if it does not match the coordinate data. This can be
> useful to produce interesting lighting effects."
>
>
> patch objects also have the VertexNormals property
From: Walter Roberson on
Ana wrote:

> By 3D plot I mean for instance you have a plot having :
>
> Z = exp(-s*t) where s = 0.25 + j
>
> When plotting with feather(Z), You get a spiral and these show the
> vectors that are rotating. Therefore can one obtain, their magnitude and
> angle (phase) ?

Note that feather() produces a 2D plot, not a 3D plot.

Tracing through the code, I find that if you let

h = feather(Z);

then

ridat = cell2mat(get(h(1:end-1),'XData'));
ridat = radat - (1:size(ridat,1)).' * ones(1,5);
reconstructedZ = ridat(:,2) - 1j * ((ridat(:,3) - ridat(:,2)*.8)/0.08);
clear ridat

This will work whether the original Z was a vector or an array, but if the
original Z was an array, then you will need to reshape() reconstructedZ to the
form of the original array as feather internally unravels Z before the
calculations.

Now if what you really used was quiver3(), then I've just wasted my time ;-(
From: Ana on
Hi Walter,

Thanks alot for your time. I have used feather(Z), so thanks alot for the explanation. I will try it out. Thanks again.

Regards
Ana

Walter Roberson <roberson(a)hushmail.com> wrote in message <hlv0tu$5lt$1(a)canopus.cc.umanitoba.ca>...
> Ana wrote:
>
> > By 3D plot I mean for instance you have a plot having :
> >
> > Z = exp(-s*t) where s = 0.25 + j
> >
> > When plotting with feather(Z), You get a spiral and these show the
> > vectors that are rotating. Therefore can one obtain, their magnitude and
> > angle (phase) ?
>
> Note that feather() produces a 2D plot, not a 3D plot.
>
> Tracing through the code, I find that if you let
>
> h = feather(Z);
>
> then
>
> ridat = cell2mat(get(h(1:end-1),'XData'));
> ridat = radat - (1:size(ridat,1)).' * ones(1,5);
> reconstructedZ = ridat(:,2) - 1j * ((ridat(:,3) - ridat(:,2)*.8)/0.08);
> clear ridat
>
> This will work whether the original Z was a vector or an array, but if the
> original Z was an array, then you will need to reshape() reconstructedZ to the
> form of the original array as feather internally unravels Z before the
> calculations.
>
> Now if what you really used was quiver3(), then I've just wasted my time ;-(