From: Diego Lass on
Hi there,
I posted something before but did not make it a clear, let me explain my problem.

I want to graph a 3D plot in Matlab by assembling "slices",(like frames in a movie)

Example:

A = [1 2 3 4;
5 6 7 8;
9 10 11 12];

B = [1 2 3];


B corresponds to the common x value in each slice. Each column in A is a slice:
there are four slices: 1) [x = 1 y =1], [2 5], [3 9] column 1 is [1;5;9]
2) [1 2] [2 6] [3 10]
3) [1 3] [2 7] [3 11]
4) [1 4] [2 8] [3 12]

Use movie analogy, I want to plot a 3D with the Z axis acts like a "Time"(1:4) and each slice is a frame in the movie.

How to plot this 3D plot most efficiently without doing anything to the matrices? I read surf function but failed to make it work.

Thanks!
Diego
From: Saurabh Mahapatra on
Hi there,

I still have some questions about your problem formulation.

1. The elements in the matrix A that you are showing in the example are 2D coordinates. Is that correct?

2. From slice to slice, do these vertices move or are these a new set of vertices? I see in your example that you have kept the number of vertices constant from slice to slice.

3. What is the shape of the area enclosed by these vertices? Is it convex? Is there anything of interest contained within those vertices like color?

4. You are slicing at discrete intervals say z=1, 2, etc. Are you suggesting that the shape of the slice obtained say at z=1 remains constant in the interval 1<=z<2?

Before I can suggest anything, I am trying to understand the 3D solid that you are trying to create.

Thanks,

Saurabh
From: Diego Lass on
Hi Saurabh,

Example:

A = [1 2 3 4;
5 6 7 8;
9 10 11 12];

B = [1 2 3];

1,2) Yes materix A is n-by-k , B is 1-by-n . The 3-D plot have slices with the fixed x-coordinate given by B, i.e. all slices have the same x-value. A is information of y-coordinate of each slice - each column of A is the y-coordinate of that slice.

3) The shape of the slice can be anything: it is a surface mapped by the y-coordinate of each slice. It need not be necessarily convex.

4) Oh, z is not continuous. It is discrete, corresponding to the index of each slice. Just like in a movie, each frame (slice) is a 2-D picture with x and y coordinate. The index of the frame is z coordinate.

Thanks for asking the clarifications.
Sincerely yours,
Diego


"Saurabh Mahapatra" <saurabh.mahapatra(a)mathworks.com> wrote in message <hu934t$ceg$1(a)fred.mathworks.com>...
> Hi there,
>
> I still have some questions about your problem formulation.
>
> 1. The elements in the matrix A that you are showing in the example are 2D coordinates. Is that correct?
>
> 2. From slice to slice, do these vertices move or are these a new set of vertices? I see in your example that you have kept the number of vertices constant from slice to slice.
>
> 3. What is the shape of the area enclosed by these vertices? Is it convex? Is there anything of interest contained within those vertices like color?
>
> 4. You are slicing at discrete intervals say z=1, 2, etc. Are you suggesting that the shape of the slice obtained say at z=1 remains constant in the interval 1<=z<2?
>
> Before I can suggest anything, I am trying to understand the 3D solid that you are trying to create.
>
> Thanks,
>
> Saurabh