필터 지우기
필터 지우기

surf for n-dimensional cartesian matrix

조회 수: 1 (최근 30일)
Ali Momennezhad
Ali Momennezhad 2023년 10월 23일
댓글: Ali Momennezhad 2023년 10월 26일
This is the dimension of my matrix: 1001,1201,1201 The first dimension is z, the second x and the third is y.
My question is: How can I show this matrix using surf function? or, how can I convert this matrix to a 2 dimensional matrix with dimesnions 1001, 1201 (z,r)?
Thank you
  댓글 수: 2
Ali Momennezhad
Ali Momennezhad 2023년 10월 26일
Thank you for your help. I used volshow and managed to show the volume. But I am wondering if I can put axis x,y and z on the viewer3d? At the moment my target shape is in the middle of a large space.

댓글을 달려면 로그인하십시오.

답변 (1개)

John D'Errico
John D'Errico 2023년 10월 23일
편집: John D'Errico 2023년 10월 23일
You cannot do so. That makes no sense at all, sorry.
You actually have a FOUR dimensional problem, thus W(x,y,z). This is because your matrix contains a 4th variable. And surf cannot handle that case, no matter what you do.
Ok, you can fix Z at any level, then taking a slice of the matrix. The result is now something surf can handle. But it is only one tiny piece of the matrix. The analogy here is lie the blind (but wise) men looking at an elephant. One feels a leg, and decides the elephant is like a giant tree. Another feels the tail, and decides the elephant is like a rope. Another feels the trunk, and thinks the elephant is a giant snake. Another feels the body, and decides it is like a huge wall. A final one feels an ear, and thinks it is like a floppy sheet, perhaps a wing.
Could you plot many slices of the matrix in the same plot? Yes. That may be your only real option. Color each surface with a different color, then label the slices using a legend. In the end, your plot will very possibly look confusing.
Is here any alternative? Well, possibly. You can plot an iso-surface. So the set of all (x,y,z), such that W takes on a specific value. This is essentially a contour plot, but with three independent variables. (help isosurface).
  댓글 수: 3
Ali Momennezhad
Ali Momennezhad 2023년 10월 23일
Matrix is comprised of (z,x,y)
So,how can I create a matrix of (z,r) where r is sqrt(x.^2+y.^2) ?
John D'Errico
John D'Errico 2023년 10월 23일
Hint: Can you use meshgrid? Or ndgrid? Once you have x and y as matrices, can you compute r? Do you have a formula for that?
Of course, generating an array that large seems a bit silly, thus of size 1001x1201x1201, will require
1001*1201*1201*8/1024^3
ans = 10.7575
So close to 11 Gigabytes of RAM just to store one array. But you will be generating 3 such matrices, x,y, and z. So you need 33 GB of RAM.
And MATLAB will require contiguous ram. This is not your hard disk space, but RAM. On top of that, if you will do ANY computations on an array that large, now you will need at least twice that available space, if not 3 times. So you probably need at least 96 GB of RAM just to work with arrays of that size.
I would suggest you either get a big computer, way bigger than most laptops have for RM, or learn to work on smaller problems.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Scalar Volume Data에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by