# std

## 语法

``tsstd = std(tsobj)``
``tsstd = std(tsobj,flag)``

## 说明

``tsstd = std(tsobj)` 计算金融时间序列对象 `tsobj` 中每个数据序列的标准差，并在 `tsstd` 中返回结果。`tsstd` 输出是一个字段名称与数据序列名称相同的结构体。`

``tsstd = std(tsobj,flag)` 按 `flag` 中的指示对数据进行归一化。`

## 示例

1. 创建一个 `fints` 对象。

`dates_and_times = (now:now+5)'`
```dates_and_times = 1.0e+05 * 7.3840 7.3840 7.3840 7.3841 7.3841 7.3841 ```
` tsobj = fints(dates_and_times, randn(6,1))`
```Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. > In fints (line 169) ```
```tsobj = desc: (none) freq: Unknown (0) {'dates: (6)'} {'times: (6)'} {'series1: (6)'} {'07-Sep-2021'} {'12:30' } {[ 0.5377]} {'08-Sep-2021'} {'12:30' } {[ 1.8339]} {'09-Sep-2021'} {'12:30' } {[ -2.2588]} {'10-Sep-2021'} {'12:30' } {[ 0.8622]} {'11-Sep-2021'} {'12:30' } {[ 0.3188]} {'12-Sep-2021'} {'12:30' } {[ -1.3077]}```
2. 使用 `std` 计算标准差。

`tsstd = std(tsobj)`
```Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. > In fints/std (line 29) tsstd = struct with fields: series1: 0.8807```

## 输入参数

• `1` - 按 n（观测值数量）进行归一化

• `0` - 按 n-1 进行归一化