calculation norm divided by square root of data length

1 回表示 (過去 30 日間)
Amanda Kamphoff
Amanda Kamphoff 2021 年 10 月 10 日
コメント済み: Jan 2021 年 10 月 11 日
I'm trying to calculate noise level which the formula is already given by book
this is the formula
here I have:
r = [-33.1869365513747 - 7.19942077700726i 9.95754431609273 - 9.07572996519880i 5.11935460162031 - 9.45713125754552i 17.2406749451800 + 7.50738378923969i 22.3786796564404 + 12.6012073987034i -29.1193546016203 + 0.557636320933856i 15.3381897144724 - 3.13336628613266i 30.2746887309409 - 7.75771048053827i];
n = 16;
I tried calculate sd by:
sd=norm(r)/ sqrt(n);
the result of sd = 7.406256475699323
but if I tried calculate sd by
g = norm(r);
h = sqrt(n);
sd = g/ h;
the result would be sd = 67.332259630053100
why is that happend? what's the diffence calculating in those two?
I'm new in Matlab
  3 件のコメント
DGM
DGM 2021 年 10 月 10 日
I'm going to assume that something happened to the value of r or n in the intervening code. I don't immediately see how this could happen through any version-dependent behavior or anything.
David Goodmanson
David Goodmanson 2021 年 10 月 10 日
編集済み: David Goodmanson 2021 年 10 月 10 日
Hi Amanda,
The number of elements of r is length(r) which is 8, not 16. So this consideration will be part of the calculation as well.

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

採用された回答

Jan
Jan 2021 年 10 月 10 日
編集済み: Jan 2021 年 10 月 10 日
r = [-33.1869365513747 - 7.19942077700726i 9.95754431609273 - 9.07572996519880i 5.11935460162031 - 9.45713125754552i 17.2406749451800 + 7.50738378923969i 22.3786796564404 + 12.6012073987034i -29.1193546016203 + 0.557636320933856i 15.3381897144724 - 3.13336628613266i 30.2746887309409 - 7.75771048053827i];
n = 16;
sd1 = norm(r) / sqrt(n)
sd1 = 16.8331
g = norm(r);
h = sqrt(n);
sd2 = g / h
sd2 = 16.8331
For me it works: both give the same result, as expected, but neither 7.4 nor 67.3 .
Did you create a script called "norm" or "sqrt"?
which norm
which sqrt
  2 件のコメント
Amanda Kamphoff
Amanda Kamphoff 2021 年 10 月 11 日
Thank you! as your expected I have script called "norm"
Jan
Jan 2021 年 10 月 11 日
Fine. Then the solution is to rename your script, because it shadows the builtin function with the same name.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by