Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to Plot 3 dimensional data in Matlab

Subject: How to Plot 3 dimensional data in Matlab

From: Pavan

Date: 5 May, 2013 06:33:08

Message: 1 of 4

Hi all,
I am very very new to MATLAB from Computer Science and its really irritating me as I dont know the function names which to use to get a functionality done. Kindly help me if anyone can.

I have a 3X3 or 4X4 or 5X5 matrices which each row corresponds to a point in the respective dimension. i.e . a row in a 3X3 matrix corresponds to x axes ,y axes and z axes co ordinates. What I need to see is that atleast in 3-d I should be able to plot my data and visualize in a graph as I can do it in 2-d. I should be able to point all the points in the matrix of 3X3 and see the separability between two 3X3 matrices visually. I am really working on this past one day and Cannot figure this out. Seems it should be simple to me but dont know how to do.. Kindly help me out.

Subject: How to Plot 3 dimensional data in Matlab

From: Nasser M. Abbasi

Date: 5 May, 2013 07:16:12

Message: 2 of 4

On 5/5/2013 1:33 AM, Pavan wrote:
> Hi all,
> I am very very new to MATLAB from Computer Science and its
>really irritating me as I dont know the function names which to use
>to get a functionality done. Kindly help me if anyone can.
>
> I have a 3X3 or 4X4 or 5X5 matrices which each row corresponds to a
>point in the respective dimension. i.e . a row in a 3X3 matrix corresponds
>to x axes ,y axes and z axes co ordinates. What I need to see is that atleast
>in 3-d I should be able to plot my data and visualize in a graph as I can do
>it in 2-d. I should be able to point all the points in the matrix of 3X3
>and see the separability between two 3X3 matrices visually.
>I am really working on this past one day and Cannot figure this out.
>Seems it should be simple to me but dont know how to do.. Kindly help me out.
>


A = rand(3,5); %5 points in 3D space
plot3(A(1,:),A(2,:),A(3,:),'ro')

%ps. do not know how to draw in higher space dimensions than 3
%not enough dimensions on the computer screen to do it.


--Nasser

Subject: How to Plot 3 dimensional data in Matlab

From: Yehonatan

Date: 5 May, 2013 11:56:09

Message: 3 of 4

Hello,
I didn't understand exactly what are you trying to do here. If your new to matlab i don't think you should start by plotting data using matrices with more then 2 dimensions. I can't help you if you insist on using matrices with 3 dimensions because i'm not familiar with the method. However, if you can use 2d matrices, which has a correspond matrix for each dimension i can help you.
This is an easy code that do not help to understand how to plot 3d plot but it useful to get you started:

x = linspace(-10,10,50);
y = linspace(-10,10,50);

[x3d_grid,y3d_grid] = meshgrid(x,y);

z3d_grid = sin(x3d_grid) - cos(y3d_grid);

figure
surf(x3d_grid,y3d_grid,z3d_grid);

Subject: How to Plot 3 dimensional data in Matlab

From: Bruno Luong

Date: 5 May, 2013 12:10:09

Message: 4 of 4

"Pavan " <Pavan.Kanukollu@gmail.com> wrote in message <km4uf4$2ea$1@newscl01ah.mathworks.com>...
> Hi all,
> I am very very new to MATLAB from Computer Science and its really irritating me as I dont know the function names which to use to get a functionality done. Kindly help me if anyone can.

type
> doc

then navigate to MATLAB -> Graphics -> 2D and 3D plots

etc...

Bruno

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us