How about:
MatrixOP/O outWave=Normalize(inWave)
or
MatrixOP/O outWave=NormalizeCols(inWave)
Sorry for digging old threads out ..... I just got puzzled, because I expected the outcome of outwave1 and outwave2 in the following example to be the same:
function NormalizeTest()
Make/O/FREE w = {1, 2, 3} Duplicate/O/FREE w outwave1, outwave2
Wavestats/Q w
outwave1 /= V_Sum Print outwave1
MatrixOP/O outwave2 = Normalize(w) Print outwave2 end
It not quite clear to me to what value "Normalize(w)" actually normalizes.
Sorry for digging old threads out ..... I just got puzzled, because I expected the outcome of outwave1 and outwave2 in the following example to be the same:
function NormalizeTest()
Make/O/FREE w = {1, 2, 3} Duplicate/O/FREE w outwave1, outwave2
Wavestats/Q w
outwave1 /= V_Sum Print outwave1
MatrixOP/O outwave2 = Normalize(w) Print outwave2 end
It not quite clear to me to what value "Normalize(w)" actually normalizes.
Experiment confirms that MatrixOp Normalize normalizes a wave by its magnitude (that is, the square root of the sum of squares). I confirmed this by doing this:
Make junk=enoise(1)+3 duplicate junk, junk1
junk1 = junk^2 Variable ss = sqrt(sum(junk1))
junk1 = junk/ss
The result is the same as the output of MatrixOp Normalize.
Would either of these functions be of use?
wave wname
WaveStats/Q wname
wname/=V_max
return 0
end
Function NormalizeByArea(wname)
wave wname
duplicate/O wname twave
integrate twave
WaveStats/Q twave
wname/=V_max
killwaves/Z twave
return 0
end
You can call them from within a larger function that loops through the waves you want to process.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 9, 2009 at 09:57 pm - Permalink
MatrixOP/O outWave=Normalize(inWave)
or
MatrixOP/O outWave=NormalizeCols(inWave)
or if you want to normalize to the maximum value:
MatrixOP/O outWave=inWave/maxVal(inWave)
A.G.
WaveMetrics, Inc.
May 11, 2009 at 11:08 am - Permalink
June 23, 2009 at 01:53 pm - Permalink
Sorry for digging old threads out ..... I just got puzzled, because I expected the outcome of outwave1 and outwave2 in the following example to be the same:
Make/O/FREE w = {1, 2, 3}
Duplicate/O/FREE w outwave1, outwave2
Wavestats/Q w
outwave1 /= V_Sum
Print outwave1
MatrixOP/O outwave2 = Normalize(w)
Print outwave2
end
It not quite clear to me to what value "Normalize(w)" actually normalizes.
Cheers
Christian
April 21, 2010 at 02:21 am - Permalink
Experiment confirms that MatrixOp Normalize normalizes a wave by its magnitude (that is, the square root of the sum of squares). I confirmed this by doing this:
duplicate junk, junk1
junk1 = junk^2
Variable ss = sqrt(sum(junk1))
junk1 = junk/ss
The result is the same as the output of MatrixOp Normalize.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 21, 2010 at 09:27 am - Permalink
The documentation for MatrixOP Normalize() explicitly states:
"Normalization is such that the returned wave should have a unity magnitude..."
A.G.
WaveMetrics, Inc.
April 21, 2010 at 10:36 am - Permalink
thanks for pointing this out. I did look into the manual, but I missunderstood the term "unity magnitude".
C
April 21, 2010 at 11:43 pm - Permalink