Quantcast

Isosurface plot

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Isosurface plot

opens
Hello everybody,

I want to make a Fermisurface plot (isosurface plot) with octave.

I use the following commands:
the first one to insert the attached file,
and the second one to make an isosurface plot according to the manual (https://www.gnu.org/software/octave/doc/interpreter/Three_002dDimensional-Plots.html).



>> M=load ("-ascii", "FERMISURF.OUT")
>>  isosurface (M(1:end,1), M(1:end,2), M(1:end,3), M(1:end,4), 0.0);


M(1:end,1), M(1:end,2), M(1:end,3) are indicating the first 3 columns, i.e. the x,y,z coordinates, M(1:end,4) indicates the value at the x,y,z coordinate and 0.0 is the isovalue.

I already checked the output of M(1:100,1), I think it should be fine.

But I get the following errors which I don't understand at all:

error: isosurface: V must be a non-singleton 3-dimensional matrix
error: called from
    isosurface>__get_check_isosurface_args__ at line 307 column 5
    isosurface at line 152 column 42

Do you have any suggestions?
Thank you in advance!

Best regards,
Arthur Niedermayr



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

FERMISURF.OUT (887K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Isosurface plot

NJank
On Mon, May 1, 2017 at 7:59 AM, "Niedermayr, Arthur" <[hidden email]> wrote:

>> M=load ("-ascii", "FERMISURF.OUT")
>>  isosurface (M(1:end,1), M(1:end,2), M(1:end,3), M(1:end,4), 0.0);


M(1:end,1), M(1:end,2), M(1:end,3) are indicating the first 3 columns, i.e. the x,y,z coordinates, M(1:end,4) indicates the value at the x,y,z coordinate and 0.0 is the isovalue.

I already checked the output of M(1:100,1), I think it should be fine.

But I get the following errors which I don't understand at all:

error: isosurface: V must be a non-singleton 3-dimensional matrix
error: called from
    isosurface>__get_check_isosurface_args__ at line 307 column 5
    isosurface at line 152 column 42



the issue isn't your first three inputs, but as it says the fourth input (V) should not be a vector. it should be a 3D matrix with values at each intersection of x,y, and z.  Here's a modified version of the first demo (see halfway down this page [1]):

clf;
[x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
v = x.^2 + y.^2 + z.^2;
xx = x(1,:,1)(:);
yy = y(:,1,1)(:);
zz = z(1,1,:)(:);
isosurface (xx, yy, zz, v, 1); axis equal; title ("isosurface() of a sphere");

v is still a matrix, not a vector, even though you are specifying x, y, and z as vectors

[1] https://octave.sourceforge.io/octave/function/isosurface.html



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Isosurface plot

opens
Hello Mr. Janowski,

to be honest, I think I know what you mean, but I don't understand you thoroughly.

What I mean:
In your example v is a scalar of one combinations of x, y and z.
And v will be recalculated for all possible configurations of x,y and z.
clf;
[x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
v = x.^2 + y.^2 + z.^2;

And in my example I assign a value to each combination.

My question is the following:
How can I transform my data, which is a 1D-array, such that I can use the isosurface function?
(I am sure it's possible with the data I have)
Could you maybe post yourself an example how the isosurface function can be used with data from an imported file?

Best regards and thank you very much!
Arthur Niedermayr



-------- Original Message --------
Subject: Re: Isosurface plot
Local Time: May 1, 2017 4:57 PM
UTC Time: May 1, 2017 2:57 PM
To: "Niedermayr, Arthur" <[hidden email]>

On Mon, May 1, 2017 at 7:59 AM, "Niedermayr, Arthur" <[hidden email]> wrote:


>> M=load ("-ascii", "FERMISURF.OUT")
>>  isosurface (M(1:end,1), M(1:end,2), M(1:end,3), M(1:end,4), 0.0);


M(1:end,1), M(1:end,2), M(1:end,3) are indicating the first 3 columns, i.e. the x,y,z coordinates, M(1:end,4) indicates the value at the x,y,z coordinate and 0.0 is the isovalue.

I already checked the output of M(1:100,1), I think it should be fine.

But I get the following errors which I don't understand at all:

error: isosurface: V must be a non-singleton 3-dimensional matrix
error: called from
    isosurface>__get_check_isosurface_args__ at line 307 column 5
    isosurface at line 152 column 42


the issue isn't your first three inputs, but as it says the fourth input (V) should not be a vector. it should be a 3D matrix with values at each intersection of x,y, and z.  Here's a modified version of the first demo (see halfway down this page [1]):

clf; [x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2); v = x.^2 + y.^2 + z.^2;
xx = x(1,:,1)(:);
yy = y(:,1,1)(:);
zz = z(1,1,:)(:);
isosurface (xx, yy, zz, v, 1); axis equal; title ("isosurface() of a sphere");

v is still a matrix, not a vector, even though you are specifying x, y, and z as vectors




_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Isosurface plot

karl
Am 04.05.2017 um 21:35 schrieb "Niedermayr, Arthur":
Hello Mr. Janowski,

to be honest, I think I know what you mean, but I don't understand you thoroughly.

What I mean:
In your example v is a scalar of one combinations of x, y and z.
And v will be recalculated for all possible configurations of x,y and z.
clf;
[x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
v = x.^2 + y.^2 + z.^2;

And in my example I assign a value to each combination.

My question is the following:
How can I transform my data, which is a 1D-array, such that I can use the isosurface function?
(I am sure it's possible with the data I have)
Could you maybe post yourself an example how the isosurface function can be used with data from an imported file?

Best regards and thank you very much!
Arthur Niedermayr



-------- Original Message --------
Subject: Re: Isosurface plot
Local Time: May 1, 2017 4:57 PM
UTC Time: May 1, 2017 2:57 PM
To: "Niedermayr, Arthur" [hidden email]

On Mon, May 1, 2017 at 7:59 AM, "Niedermayr, Arthur" <[hidden email]> wrote:


>> M=load ("-ascii", "FERMISURF.OUT")
>>  isosurface (M(1:end,1), M(1:end,2), M(1:end,3), M(1:end,4), 0.0);


M(1:end,1), M(1:end,2), M(1:end,3) are indicating the first 3 columns, i.e. the x,y,z coordinates, M(1:end,4) indicates the value at the x,y,z coordinate and 0.0 is the isovalue.

I already checked the output of M(1:100,1), I think it should be fine.

But I get the following errors which I don't understand at all:

error: isosurface: V must be a non-singleton 3-dimensional matrix
error: called from
    isosurface>__get_check_isosurface_args__ at line 307 column 5
    isosurface at line 152 column 42


the issue isn't your first three inputs, but as it says the fourth input (V) should not be a vector. it should be a 3D matrix with values at each intersection of x,y, and z.  Here's a modified version of the first demo (see halfway down this page [1]):

clf; [x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2); v = x.^2 + y.^2 + z.^2;
xx = x(1,:,1)(:);
yy = y(:,1,1)(:);
zz = z(1,1,:)(:);
isosurface (xx, yy, zz, v, 1); axis equal; title ("isosurface() of a sphere");

v is still a matrix, not a vector, even though you are specifying x, y, and z as vectors





_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

Hi Arthur,

please answer below. That is the custom.

Maybe this function in octave helps you:


reshape(A,m,n)

Return a matrix with the specified dimensions (m, n, …) whose elements are taken from the matrix A.

The elements of the matrix are accessed in column-major order (like Fortran arrays are stored).

The following code demonstrates reshaping a 1x4 row vector into a 2x2 square matrix.

reshape ([1, 2, 3, 4], 2, 2)
      ⇒  1  3
          2  4

 Ciao

Karl


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Isosurface plot

NJank
In reply to this post by opens


On May 4, 2017 2:35 PM, Niedermayr, Arthur <[hidden email]> wrote:
Hello Mr. Janowski,

to be honest, I think I know what you mean, but I don't understand you thoroughly.

What I mean:
In your example v is a scalar of one combinations of x, y and z.
And v will be recalculated for all possible configurations of x,y and z.
clf;
[x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
v = x.^2 + y.^2 + z.^2;

v is a 3D scalar field. The dimensions are 9x9x9.  It has the value of v for every point (x, y, z) defined inside the meshgrid command. x y and z produced by the meshgrid function are also 9x9x9 3D arrays with the x, y, or z value distributed over the full array. Take a look at their contents at if you're not sure what i mean. The v= line creates a full scalar field map, isosurface processes that field and identifies the surface for a certain value of v.  In my modified example I showed that isosurface can accept the vectors for x y and z uses to make the meshgrid, but still needs the full 3d field for v.

And in my example I assign a value to each combination.

If for you v is a vector the same size as x, y, and z, then it cannot be a full field map of v.


My question is the following:
How can I transform my data, which is a 1D-array, such that I can use the isosurface function?

My guess is that the day that you have in v are just the points that defined the isosurface? And x y and z are the corresponding coordinates of those points? In that case you already have found the isosurface and you don't need a function to find it for you. If you just want to plan it, maybe there's a way to just do a three-dimensional surface plot of the data you have. It's not something I do often, but you can see a number of the built-in options here

I'm not sure which of those couple be adapted to give you what you want for the type of data you have

(I am sure it's possible with the data I have)
Could you maybe post yourself an example how the isosurface function can be used with data from an imported file?

I don't think the issue is anything to do with imported data, but has to do with the type of data you're importing. If my guess above is correct, and you still want to use isosurface then you need to remap your data onto a three-dimensional field and fill in all the empty points. 


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Loading...