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:
Plotting Captured Accelerometer Data into a 3D Line Graph

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Darryl

Date: 13 May, 2013 22:01:07

Message: 1 of 10

I am trying to plot accelerometer data I captured from a comma separated file.

Firstly, I used the xlsxread function and read each column individually into variables:

x, y, z

I have already plotted this data within a 2D graph, but I am trying to display it into a more reader friendly format that displays each axis in a 3D line format that corresponds to each coordinate in space. I've tried lots of combinations within MatLab, but nothing seems to work so far.

I can attach a diagram of how I want it if I am not making things clear above.

Thanks.

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Yehonatan Peleg

Date: 14 May, 2013 01:34:09

Message: 2 of 10

Have you tried plot3........?????

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Darryl

Date: 14 May, 2013 13:25:23

Message: 3 of 10

"Yehonatan Peleg" <math8yehonatan@gmail.com> wrote in message <kms4ah$oue$1@newscl01ah.mathworks.com>...
> Have you tried plot3........?????

Yes I tried that, but I can't distinguish what axis is what. I can't even select each axis to change the colours etc.

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Steven_Lord

Date: 14 May, 2013 13:41:37

Message: 4 of 10



"Darryl " <dazgti@hotmail.com> wrote in message
news:kmte02$fum$1@newscl01ah.mathworks.com...
> "Yehonatan Peleg" <math8yehonatan@gmail.com> wrote in message
> <kms4ah$oue$1@newscl01ah.mathworks.com>...
>> Have you tried plot3........?????
>
> Yes I tried that, but I can't distinguish what axis is what.

Label them with XLABEL, YLABEL, ZLABEL.

http://www.mathworks.com/help/matlab/ref/xlabel.html

> I can't even select each axis to change the colours etc.

Use SET to change the XColor, YColor, and ZColor properties of the axes.

surf(peaks)
set(gca, 'XColor', 'r', 'YColor', [0 0.5 0.5], 'ZColor', 'y')

The X axis will be red, the Y axis will be blue-green, and the Z axis will
be yellow.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Muhammad Arslan Tariq

Date: 15 Aug, 2014 22:24:11

Message: 5 of 10

"Darryl" wrote in message <kmrnr3$n3e$1@newscl01ah.mathworks.com>...
> I am trying to plot accelerometer data I captured from a comma separated file.
>
> Firstly, I used the xlsxread function and read each column individually into variables:
>
> x, y, z
>
> I have already plotted this data within a 2D graph, but I am trying to display it into a more reader friendly format that displays each axis in a 3D line format that corresponds to each coordinate in space. I've tried lots of combinations within MatLab, but nothing seems to work so far.
>
> I can attach a diagram of how I want it if I am not making things clear above.
>
> Thanks.


Would u plz help me out regarding this can u send me your code i need it urgrntly

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Yehonatan Peleg

Date: 16 Aug, 2014 19:23:05

Message: 6 of 10

hello,
Its a very old message. i doubt he will answer. what seem to be the problem?

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Muhammad Arslan Tariq

Date: 17 Aug, 2014 23:37:09

Message: 7 of 10

"Yehonatan Peleg" <math8yehonatan@gmail.com> wrote in message <lsob2p$qif$1@newscl01ah.mathworks.com>...
> hello,
> Its a very old message. i doubt he will answer. what seem to be the problem?


I want Plotting Captured Accelerometer Data into a 3D Line Graph yhis work in matlab and also after learning the code i have to do something similar to this
kindly help me

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Yehonatan Peleg

Date: 18 Aug, 2014 12:30:08

Message: 8 of 10

I don't know exactly how your data looks like. However. if's it is a vector data, meaning that you have three vectors x,y,z of data you can use plot3 function like that:

Start code....................................

clear

%Creating Data
x = -50:0.5:50;
y = x.^2;
z(1,1:201) = -50:0.5:50;

%Plotting Data
plot3(x,y,z);

%Setting Name And Colors To The Axis
XLABEL('X Axis');
YLABEL('Y Axis');
ZLABEL('Z Axis');
set(gca, 'XColor', 'r', 'YColor', [0 0.5 0.5], 'ZColor', 'y')

End Code..................................

Anyway, If your data it different or you need some other kind of plot function tell me.

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Riko

Date: 18 Aug, 2014 15:53:12

Message: 9 of 10

"Yehonatan Peleg" <math8yehonatan@gmail.com> wrote in message <lssrkg$bsb$1@newscl01ah.mathworks.com>...
> I don't know exactly how your data looks like. However. if's it is a vector data, meaning that you have three vectors x,y,z of data you can use plot3 function like that:
>
> Start code....................................
>
> clear
>
> %Creating Data
> x = -50:0.5:50;
> y = x.^2;
> z(1,1:201) = -50:0.5:50;
>
> %Plotting Data
> plot3(x,y,z);
>
> %Setting Name And Colors To The Axis
> XLABEL('X Axis');
> YLABEL('Y Axis');
> ZLABEL('Z Axis');
> set(gca, 'XColor', 'r', 'YColor', [0 0.5 0.5], 'ZColor', 'y')
>
> End Code..................................
>
> Anyway, If your data it different or you need some other kind of plot function tell me.

Hey, I also want to plot accelerometer data I have collected. The data is available in an SQLite DB or as a CSV text file. The content of the text file looks like this

"x","y","z","horizontalAcceleration","lat","long","speed","time","activity"
-0.00100799649953842,0.00227271788753569,-0.0165852922946215,0.0167706049978733,49.2068405151367,9.19633674621582,0.0,0,2
0.00154940853826702,0.000887474801857024,-0.0150941433385015,0.015199389308691,49.2068405151367,9.19633674621582,0.0,0,2
0.0017551186028868,0.000360023375833407,-0.0141938123852015,0.0143064456060529,49.2068405151367,9.19633674621582,0.0,0,2

I would be glad if you could tell me how to import this data into matlab and then plot it. Many thanks in advance!

Subject: Plotting Captured Accelerometer Data into a 3D Line Graph

From: Yehonatan Peleg

Date: 18 Aug, 2014 16:31:07

Message: 10 of 10

Hey, you can use this tow topics to learn how do so, i found them using Google cuz i don't use csv files. Good Luck!!!

site 1)http://www.mathworks.com/matlabcentral/answers/72545-how-to-import-csv-file-in-matlab

site 2)http://www.mathworks.com/matlabcentral/fileexchange/23573-csvimport

Tags for 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