# How to plot x y z coordinates and combine them with a 4th dimension

3 Ansichten (letzte 30 Tage)
Moritz am 17 Dez. 2012
Hello,
i am pretty new at MATLAB and have to learn a lot.
So i have a question who is very difficult for me.
I wanna plot a 3D Model of some x y and z coordinates. These 3 Coordinates are easy to plot, but now i want to give every single x,y and z position a 4 dimension. In my example it is the used power of car at every position.
Is it possible to plot this 4th domension at every position of x,y and z in a special color?
Code:
x,y and z position :
figure(2); plot3(data.rail.raw_data(:,2),data.rail.raw_data(:,1),data.rail.raw_data(:,3)); grid on;
used power:
a=data.vehicle.history.Ebt(1)-data.vehicle.history.Ebt;
Moritz
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Kelly Kearney am 17 Dez. 2012
doc scatter3
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Jonathan Epperl am 17 Dez. 2012
Afaik it is not possible to do that directly since plot3 creates a line, and lines have only one color. However what you could do:
• Check the File Exchange, I'm sure there is stuff for that
• Plot every point on you car's trajectory individually and give it the right color
• Expand the trajectory a little into a strip and plot it using mesh or surf, they allow you a 4th argument which represents the color.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by