Having issues with a function: creates NxN matrix instead of a column vector

3 ビュー (過去 30 日間)
Maryam Mustafayeva
Maryam Mustafayeva 2019 年 12 月 10 日
コメント済み: Maryam Mustafayeva 2019 年 12 月 10 日
Hello all,
Below is the function that I've created:
function p=logodds(p,sigma,N)
e = normrnd(0,sigma,[N,1]);
Lo = log10(p/(1-p)+ e);
p = 10.^Lo/(1+10.^Lo);
end
When I call the function, it gives me NxN matrix in which 1 column vector of a result of the function and the others are zeros.
I need just a column vector of a result.
Thanks in advance

回答 (1 件)

Jeremy
Jeremy 2019 年 12 月 10 日
Are the inputs p, sigma, N scalar values or vectors? Does normrnd return a vector or a scalar? That seems to be a function you wrote
  1 件のコメント
Maryam Mustafayeva
Maryam Mustafayeva 2019 年 12 月 10 日
Dear Jeremy,
The inputs p,sigma and N are scalar values, whereas normrnd return a vector.

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

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by