calculation norm divided by square root of data length

1 次查看(过去 30 天)
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 个评论
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 CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by