Maximum value of a normalized power changes

조회 수: 2 (최근 30일)
possibility
possibility 2018년 11월 11일
댓글: possibility 2018년 11월 14일
I have a function (looks like gaussian) and I want to plot it such that the area under the plot is always 1 (power normalization). I know it is done by dividing the function by its L2-norm. What is interesting here is, when the sample size increases, maximum value of the function decreases. here is the code:
al=-pi/2: pi/10: pi/2;
cf=((1+cos(al))/2).^1;
plot(al,cf/norm(cf));
hold on;
al=-pi/2: pi/100: pi/2; %increase the sample size
cf=((1+cos(al))/2).^1;
plot(al,cf/norm(cf));
It must be independent of the sample size. It seems I need to multiply cf with length(cf) or length(cf)^2 to get a fixed maximum value for a normalized power but couldn't find out a takeaway from that.
Thanks in advance.

채택된 답변

David Goodmanson
David Goodmanson 2018년 11월 12일
Hi pos,
First of all, if you want to approximate the area, that's done with intervals and not with points. Just summing the squares of the points overweights the two end points. However, you can average the each interval over adjacent points (simple trapezoidal rule) with
cfave = (cf(1:end-1)+cf(2:end))/2
The integral is approximated with
sum(cfave.^2)*h
where h is the width of the intervals, assuming they are all the same. That is the factor you were missing.
Let C be the normalization factor for cfave such that
sum((C*cfave).^2)*h = 1
this works out to
C = 1/(norm(cfave)*sqrt(h))
The code below gives almost exactly the same plot for different values of the interval like you were doing before.
a=-pi/2: pi/10: pi/2;
cf=((1+cos(a))/2).^1;
cfave = (cf(1:end-1)+cf(2:end))/2;
h = pi/length(cfave);
C = 1/(norm(cfave)*sqrt(h))
cfnorm = C*cf; % back to points
figure(1)
plot(a,cfnorm);
  댓글 수: 5
David Goodmanson
David Goodmanson 2018년 11월 13일
편집: David Goodmanson 2018년 11월 14일
Hi pos,
--modified--
Either you added the plot later or I missed it, but either way seeing it now helps.
There are two possible contexts for this. The first is an array for signal processing, where the interval between points is set by the sampling frequency. In that case, given that the points are equally spaced, intermediate calculations are done without paying much attention to the size of the actual interval. Let's say you normalize the function either by
cfnorm = cf/sum(cf) [1] or cfnorm = cf/norm(cf) [2]
which are the digital 'equivalent' of L1 and L2. As the order of the function increases, the peak gets narrower and narrower until in both cases the function finally becomes
cf = 1 at the middle point
= 0 everwhere else
This satisfies
sum(cf) = 1 [1] or sum(cf^2) = 1 [2]
That's what is in your plot. For [1], it is the discrete version of a delta function.
The second context is approxmating a continuous function with an array, which is what the original question seems to refer to. Leaving out for the moment the distinction between points and intervals (which is still important), you are approximating an integral by
sum(cf)*dx [3] (L1) or sum(cf^2)*dx [4] (L2)
The exrtra dx makes a large difference. The normalized functions are
cfnorm = cf/(sum(cf)*dx) [3] or cfnorm = cf/(norm(cf)*sqrt(dx)) [4]
As you increase the number of points in a fixed interval, the size of dx decreases and the peak increases, so that as I mentioned before the height is proportional to 1/width. Also, in this case since you are approximating a continuous function, as order goes up and the peak gets narrower you have to make dx smaller in order to accurately represent the peak.
[3] is the approximation of the delta function, its precision limited by the size of dx.
So you can have the height = 1 as for the first context, or the approximated continuous integral = 1 as for the second context, but you can't have both.
possibility
possibility 2018년 11월 14일
Hi David,
I truly appreciate your concern and the time you spent.
I think I understand the concept. Since the total area or the sum of points cannot exceed the total power (say, Pt=1) in my case, the order has a maximum value of 12.3 for L1 normalization. I need to go further with that constraint.
I realized that this problem seems highly related to array processing field.
By the way, since your very first comment answers the topic's question, I accepted that answer. Thank you so much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by