help-octave
[Top][All Lists]
Advanced

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

Re: [newbie] plotting function of three variables


From: James Sherman Jr.
Subject: Re: [newbie] plotting function of three variables
Date: Mon, 11 Feb 2013 11:56:51 -0500

On Mon, Feb 11, 2013 at 11:32 AM, Ben Abbott <address@hidden> wrote:
> On Feb 11, 2013, at 11:30 AM, Doug Stewart wrote:
>
>> On Mon, Feb 11, 2013 at 11:20 AM, Hugo Coolens <address@hidden> wrote:
>>> I have a function f(x,y,z) for which I'd like to have a graphical 
>>> representation. I know f(x,y,z) varies between 1 and a maximum value, so I 
>>> thought it would be nice
>>> to represent each x,y,z-point by a pixel for which white represents 1 and 
>>> black represents the maximum value of f(x,y,z). Intermediate values could 
>>> be presented by a grayish according to the value.
>>> Can this be done in Octave, or can someone point me to similar examples and 
>>> solutions,
>>>
>>> thanks in advance
>>> hugo
>>
>> Why not use the same ideas as sombrero??
>>
>> type sombrero at the prompt.
>
> If you're looking for a scatter plot in 3D ...
>
>         help scatter3
>
> If something like "sombrero" is what you're looking for ...
>
>         help surf
>
> Ben
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

I maybe misinterpreting the question, but surf and sombrero are both
of the form that z = f(x,y) or in other words, a surface, where this
gentlemen is looking to view a solid, or w = f(x,y,z).  The quickest
(and dirtiest) way I could think do to this would be to use surf as a
way to show slices of the solid.  So maybe something like:

x = -5:5;
[xx, yy] = meshgrid(x,x);

figure;
hold on;

for ii = -5:5,
   dist = sqrt(xx.^2 + yy.^2+ii.^2);
   zz = ii*ones(size(xx));

   mesh(xx, yy, zz, dist);
end

But, there probably are better ways, but this might be a good start?

Hope this helps,

James Sherman


reply via email to

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