How can i get standard deviation in a scatter3 plot

figure
scatter3(SL0,SR0,V0,15)
hold on
scatter3(SL20,SR20,V20,15)
scatter3(SL30,SR30,V30,15)
plot3(L2,L1,L3,'b')
plot3(LL2,LL1,LL3,'r')
plot3(LLL2,LLL1,LLL3,'k')
hold off
grid on
This is my current code which gives me
matlab_help.png
I would like to get a standard deviation in both x,y,z direction for each of the data points (the 9 dots). I think it's rather advanced, so is it even possible?

回答(1 个)

It would be easiest to concatenate your scalar variables into a matrix, then take the standard deviation of the matrix rows:
Smtx = [SL0, SL20, SL30; SR0, SR20, SR30; V0, V20, V30];
Ssd = std(Smtx,[],2)
Here, Ssd(1) is the standard deviation of the x-values, Ssd(2) y-values, and Ssd(3) z-values.
If you only have the three sets of scalar values, this will work. If you have more data, or if your data are different, you need to change the code accordingly.

类别

帮助中心File Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by