4D plot with matlab
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have the attached data, in which the first three columns are variables, the fourth column data was obtained as a function of the variables c1,c3, and c4.
Can any one tell me how I can plot them together?
Thank you.
0 Kommentare
Antworten (2)
Adam Danz
am 1 Apr. 2019
Bearbeitet: Adam Danz
am 2 Apr. 2019
It sounds like you've got data (stored in column 4) that vary on 3 axes (stored in cols 1:3). Perhaps a 3D contour plot or a 3D surface plot can be used where the (x,y,z) coordinates are defined by your columns 1,2,3 and the color is defined by the data in column 4. Check out the documentation for those functions and let us know if you get stuck.
Another option is to use a 3D scatter plot and color each marker according to the value in the 4th dimension.
figure
h = scatter3(data(:,1), data(:,2), data(:,3), 20, data(:,4), 'MarkerFaceColor', 'Flat');
colorbar();
caxis([min(data(:,4)), max(data(:,4))])
18 Kommentare
Adam Danz
am 5 Apr. 2019
After recommending contour3() I realized this isn't really an option since it only receives (X,Y,Z) values. My initial thought was to change the colors to your values in the 4th column but I'm no longer sure that's possible. I looked at the 2nd output to contour3() which is the handle to the plot and it wasn't immediately apparent how to access and change the color values.
Siehe auch
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!
