Plot X Y Z data

90 次查看(过去 30 天)
fz
fz 2023-1-20
回答: Voss 2023-2-14
I need to plot X, Y, Z graph with X being time (or approximate time if easier to plot); Y being total counts and Z being concentration. Data is shown below.

回答(1 个)

Voss
Voss 2023-2-14
ZYX = [ ...
100 454292352 480.9; ...
100 242004000 241.3; ...
100 133391456 122.2; ...
100 66707360 61 ; ...
100 34087840 30.8; ...
10 131312864 483 ; ...
10 66422080 240.6; ...
10 34292800 122.9; ...
10 17087072 60.4; ...
10 9602784 33.7; ...
1 89836064 481.5; ...
1 45083040 241.2; ...
1 22638528 120.9; ...
1 11286688 60.2; ...
1 5770016 30.7; ...
0.1 88813312 483.7; ...
0.1 43648896 240.7; ...
0.1 22367552 124.3; ...
0.1 10805952 60.4; ...
0.1 5409248 31.2; ...
];
As requested:
figure
plot3(ZYX(:,3),ZYX(:,2),ZYX(:,1))
xlabel('Time (sec)')
ylabel('Total Events')
zlabel('Concentration (\mum)')
box on
grid on
Maybe this is better:
figure
hold on
[g,g_id] = findgroups(ZYX(:,1));
data = splitapply(@(x)plot3(x(:,3),x(:,2),x(:,1)),ZYX,g);
legend(compose('%.1f \\mum',g_id),'Location','NorthWest')
% view(3) % uncomment this to see the 3d view
xlabel('Time (sec)')
ylabel('Total Events')
zlabel('Concentration (\mum)')
box on
grid on

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by