How can i get standard deviation in a scatter3 plot

조회 수: 2 (최근 30일)
Rasmus Jessen
Rasmus Jessen 2019년 5월 8일
답변: Star Strider 2019년 5월 8일
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개)

Star Strider
Star Strider 2019년 5월 8일
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.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by