필터 지우기
필터 지우기

Computing the Standard Deviation of Values in a column in Matlab

조회 수: 3 (최근 30일)
Jana Sarran
Jana Sarran 2023년 4월 25일
댓글: Torsten 2023년 4월 27일
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
Dominique Gorissen
Dominique Gorissen 2023년 4월 25일
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 2023년 4월 25일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by