4D plot with matlab
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Adam Danz
2019-4-1
编辑:Adam Danz
2019-4-2
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 个评论
Adam Danz
2019-4-5
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
