How to plot a 4D plot (X , Y , Z and Intensity) ??

조회 수: 6 (최근 30일)
Abdullah Malik
Abdullah Malik 2015년 10월 13일
답변: Ayush 2024년 12월 5일
I have like 4 Columns (X,Y,Z and Intensity). How can I plot a 4D plot??
-5.000000e-03 -5 -2 1808724575000000 -4.989990e-03 -5 -2 1771033352400000 -4.979980e-03 -5 -2 1726418476100000 -4.969970e-03 -5 -2 1675286124200000 -4.959960e-03 -5 -2 1618110215600000 -4.949950e-03 -5 -2 1555428767400000 -4.939940e-03 -5 -2 1487838612700000 -4.929930e-03 -5 -2 1415988772600000 -4.919920e-03 -5 -2 1340576095300000
Thanks...

답변 (1개)

Ayush
Ayush 2024년 12월 5일
Hi,
To plot a 4D plot where you have columns for X, Y, Z, and Intensity, you can use the “scatter3” function, which allows you to visualize data in three dimensions and use the fourth dimension to control the colour or size of the markers. Refer to an example implementation for a better understanding:
% Define your data
X = [-5.000000e-03, -4.989990e-03, -4.979980e-03, -4.969970e-03, -4.959960e-03, -4.949950e-03, -4.939940e-03, -4.929930e-03, -4.919920e-03];
Y = [-5, -5, -5, -5, -5, -5, -5, -5, -5];
Z = [-2, -2, -2, -2, -2, -2, -2, -2, -2];
Intensity = [1808724575000000, 1771033352400000, 1726418476100000, 1675286124200000, 1618110215600000, 1555428767400000, 1487838612700000, 1415988772600000, 1340576095300000];
% Create a 3D scatter plot
scatter3(X, Y, Z, 36, Intensity, 'filled');
% Add labels and title
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
title('4D Plot using scatter3');
% Add a colorbar to show the intensity scale
colorbar;
colormap jet; % You can change the colormap as needed
For more information on the “scatter3” function refer to the below documentation:

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by