Standard deviation of 2D array

Hi,
I am trying to calculate the standard deviation of 2D array 'v' of dimesnion 89 x 97.
I have tried as follows ,but it returns the output in the form of 1 x 97 instread of 89 x 97. Could someone help me with this
V1 = std (v);

 Risposta accettata

Star Strider
Star Strider il 6 Nov 2021

0 voti

The standard deviation of a scalar is 0 so the result is —
standard_deviation_v = zeros(size(v))
in this instance.
.

4 Commenti

Hi,
Thanks I just checked. Though it yields results in 89 x 97 array, however, all the standard deviation values are zero..
As they should be.
The standard deviations are valid and non-zero if taken across rows or columns (on in a multidmiensional array, a specific dimension).
Calculating the standard deivation across the third dimension here (so each individual scalar) produces —
v = rand(89,97)
v = 89×97
0.3176 0.4743 0.4498 0.2482 0.4525 0.6837 0.4908 0.2914 0.9379 0.1937 0.6850 0.5043 0.2961 0.2275 0.7154 0.2022 0.0023 0.9774 0.0146 0.9340 0.9574 0.3732 0.7484 0.0872 0.1360 0.5074 0.5602 0.8739 0.0030 0.5378 0.2584 0.1894 0.3723 0.9644 0.0514 0.3840 0.5639 0.4938 0.4834 0.4695 0.6003 0.3930 0.9223 0.2461 0.2159 0.4884 0.8516 0.6950 0.9837 0.4972 0.1860 0.1820 0.2270 0.2164 0.3897 0.0965 0.4047 0.9546 0.3066 0.9510 0.0362 0.5856 0.0955 0.1356 0.7095 0.5816 0.1061 0.9346 0.1909 0.4830 0.9627 0.5205 0.6587 0.7511 0.4202 0.0762 0.2718 0.0027 0.5365 0.9341 0.5114 0.1364 0.6142 0.8989 0.0643 0.5395 0.2587 0.3957 0.8722 0.8927 0.5580 0.9194 0.7983 0.8412 0.5769 0.8895 0.3469 0.0505 0.1800 0.6799 0.4938 0.5923 0.2852 0.6942 0.6023 0.3313 0.9509 0.0939 0.5642 0.8119 0.9132 0.2708 0.7792 0.8428 0.6634 0.7914 0.1808 0.4120 0.7127 0.8783 0.5743 0.9389 0.4356 0.2958 0.1456 0.0101 0.0334 0.3761 0.0551 0.5322 0.4195 0.3785 0.6602 0.7843 0.1021 0.5288 0.5701 0.9108 0.1013 0.9304 0.1100 0.1890 0.4810 0.9255 0.3429 0.0091 0.4485 0.1633 0.5688 0.0930 0.4730 0.7792 0.0324 0.9049 0.0409 0.9804 0.1001 0.6882 0.8350 0.0176 0.9968 0.2064 0.1408 0.8134 0.8692 0.8671 0.8323 0.2955 0.8186 0.3277 0.0561 0.5148 0.4377 0.1855 0.2647 0.1639 0.6836 0.6931 0.5509 0.3950 0.6487 0.9884 0.9817 0.3008 0.0589 0.3406 0.1499 0.7129 0.7021 0.3067 0.5540 0.4717 0.2021 0.3025 0.2733 0.4091 0.8190 0.3141 0.4931 0.2977 0.8817 0.4532 0.0145 0.5354 0.9743 0.0855 0.2653 0.3339 0.8514 0.1727 0.8610 0.7541 0.0731 0.5767 0.3492 0.6835 0.5188 0.1462 0.9584 0.1433 0.8594 0.1973 0.6940 0.7562 0.7208 0.4494 0.9059 0.5781 0.0174 0.8602 0.1506 0.9939 0.0943 0.9477 0.7425 0.5248 0.5851 0.8669 0.0807 0.4423 0.4303 0.6783 0.5461 0.7124 0.7804 0.7018 0.6898 0.6771 0.7743 0.1767 0.4670 0.4155 0.8837 0.0245 0.7318 0.0056 0.4344 0.6394 0.6097 0.7438 0.0043 0.3886 0.8524 0.8176 0.8685 0.8124 0.8072 0.6733 0.3688 0.1457 0.6304 0.3754 0.7873 0.5024 0.5350 0.9765 0.5470 0.0514 0.9915 0.1818 0.8456 0.2711 0.0711 0.3204 0.8498 0.2127 0.4112 0.8229 0.8036 0.5223 0.8232 0.9784 0.7524 0.1801 0.7947 0.7446 0.5634 0.7837 0.1725 0.1128
standard_deviation_v = std(v,[],3)
standard_deviation_v = 89×97
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
This is of course the expected result.
.
Ok, I will look into this..
Thank you.
.

Accedi per commentare.

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by