How to implement a Bivariate Normal Density function when your mu is given in a column matrix

Dear all, I'm fairly new to Matlab and I'm trying to implement a Bivariate Normal Density function but mu is given in a column matrix. mvnpdf as a function will only take row matrices. All the examples I have seen are considering mu as horizontal array. I even tried to implement the formula mathematically but I can not get to multiply properly (X-MU)*Covariance transposed * (X-MU) without getting an error that the inner matrix dimensions must agree. I can tell that the order does not agree....Any ideas on either approach? Any help highly appreciated. Thanks in advance....

回答 (1 件)

Honglei Chen
Honglei Chen 2012 年 1 月 27 日
Just pass in mu.' instead, i.e.,
mvnpdf(x,mu.')

3 件のコメント

Neftali Ricardo
Neftali Ricardo 2012 年 1 月 27 日
Hello Hoglei,
How are you? What do you mean with "pass in" ? ...
Honglei Chen
Honglei Chen 2012 年 1 月 27 日
Just as what I show in the example. Use .' to convert a column vector to a row vector
Neftali Ricardo
Neftali Ricardo 2012 年 1 月 27 日
But then, the mu will not be the same as given and that would change the results of the Normal Density function?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

質問済み:

2012 年 1 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by