# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# getAssetMoments

Obtain mean and covariance of asset returns from Portfolio object

Use the `getAssetMoments` function with a `Portfolio` object to obtain mean and covariance of asset returns.

For details on the workflow, see Portfolio Object Workflow.

## Syntax

``````[AssetMean,AssetCovar] = getAssetMoments(obj)``````

## Description

example

``````[AssetMean,AssetCovar] = getAssetMoments(obj)``` obtains mean and covariance of asset returns for a `Portfolio` object.```

## Examples

collapse all

Given the mean and covariance of asset returns in the variables `m` and `C`, the asset moment properties can be set and then obtained using the `getAssetMoments` function:

```m = [ 0.05; 0.1; 0.12; 0.18 ]; C = [ 0.0064 0.00408 0.00192 0; 0.00408 0.0289 0.0204 0.0119; 0.00192 0.0204 0.0576 0.0336; 0 0.0119 0.0336 0.1225 ]; m = m/12; C = C/12; p = Portfolio; p = setAssetMoments(p, m, C); [assetmean, assetcovar] = getAssetMoments(p)```
```assetmean = 0.0042 0.0083 0.0100 0.0150 ```
```assetcovar = 0.0005 0.0003 0.0002 0 0.0003 0.0024 0.0017 0.0010 0.0002 0.0017 0.0048 0.0028 0 0.0010 0.0028 0.0102 ```

## Input Arguments

collapse all

Object for portfolio, specified using a `Portfolio` object. For more information on creating a portfolio object, see

## Output Arguments

collapse all

Mean of asset returns, returned as a vector.

Covariance of asset returns, returned as a matrix.

## Tips

You can also use dot notation to obtain the mean and covariance of asset returns from a Portfolio object:

`[AssetMean, AssetCovar] = obj.getAssetMoments;`