Effacer les filtres
Effacer les filtres

Computing the Standard Deviation of Values in a column in Matlab

5 vues (au cours des 30 derniers jours)
Jana Sarran
Jana Sarran le 25 Avr 2023
Commenté : Torsten le 27 Avr 2023
Say I have the following dataset:
I would like to compute that standard deviation using ONLY SPEED values from ONLY 15 rows at a time in the table shown. How would I go about executing this in Matlab? Is there a specific code that can simplify this task?
  2 commentaires
Dominique Gorissen
Dominique Gorissen le 25 Avr 2023
I am assuming that you already have this table imported into matlab? If not use the read() command to do so.
Then first convert your desired column into an array and then use std to calculate the standard deviation
SpeedArray=table2array(Table(4,:));
StandardDeviation=std(SpeedArray(1:15));
Jana Sarran
Jana Sarran le 25 Avr 2023
Thank you.
Unfortunately, this example code is not working.
In the first line of Code, I was able to extract the array values for my speed column using this code:
SpeedArray = Arraytable (:,3) %The speed data is in the third column%
However, I was not able to find the standard deviations for every 15 row of data using the other code. I believe the standard deviation calculation would need to be repeated for every 15 rows and may be required to be coded using Loops. I am not sure.

Connectez-vous pour commenter.

Réponse acceptée

Dyuman Joshi
Dyuman Joshi le 25 Avr 2023
out = std(tablename.Speed(1:15))
  5 commentaires
Jana Sarran
Jana Sarran le 27 Avr 2023
Hi @Dyuman Joshi. Thank you for your assistance. This code worked perfectly! :)
Torsten
Torsten le 27 Avr 2023
Isn't a "moving standard deviation" required, i.e. standard deviation of rows 1-15, 2-16, 3-17 etc ?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by