calculation norm divided by square root of data length

1 Ansicht (letzte 30 Tage)
Amanda Kamphoff
Amanda Kamphoff am 10 Okt. 2021
Kommentiert: Jan am 11 Okt. 2021
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 Kommentare
DGM
DGM am 10 Okt. 2021
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 am 10 Okt. 2021
Bearbeitet: David Goodmanson am 10 Okt. 2021
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 10 Okt. 2021
Bearbeitet: Jan am 10 Okt. 2021
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 Kommentare
Amanda Kamphoff
Amanda Kamphoff am 11 Okt. 2021
Thank you! as your expected I have script called "norm"
Jan
Jan am 11 Okt. 2021
Fine. Then the solution is to rename your script, because it shadows the builtin function with the same name.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by