Maximum value of a normalized power changes

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.

 Accepted Answer

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 Comments

Hi David,
Thank you for the response. I got the approach of integrating the intervals, not the samples. And yes, now, it gives fixed maximum value for any sample size.
However, when I increase the raised cosine order to a large value, say 50, (increased order shrinks the function whose limit goes to delta function eventually), the max value exceeds 1 which seems violating the
sum((C*cfave).^2)*h = 1
The ultimate goal is to find the max value (normalization coefficient) for an arbitrary order of the function. The code:
a=-pi/2: pi/10: pi/2;
cf=((1+cos(a))/2).^50; % order increases to 50
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);
Thank you.
Hi pos,
I didn't realize that you were trying to approximate a delta function. That changes things, a bit. The delta function has the normalization
Int delta(x) dx = 1
not
Int delta(x)^2 dx = 1
so 'power' normalization (L2 norm) does not apply. The C variable becomes
C = 1/(sum(fave)*h)
Looking at this function as basically a rectangle, as the function narrows (try changing 50 to 1000) its width becomes some small value w. Its peak must be 1/w so that w x (1/w) = 1. So the peak value does not stop at 1, it increases without limit.
Hi David,
I am a little confused. I am not approximating a delta function, or am I? (at least this is not my intention).
What I want is: For an infinitely small width w (for the order in the function is infinity ), the amplitude should hit 1. While increasing the width, function should slowly enlarge and ultimately (for the order of 1) the amplitude goes down to, approximately, 0.38, I guess (not sure)
So, independent of the sample size, the amplitude should in the range of [0.38, 1] while the order of the function changes. I cannot distinguish it should be done with whether L1 or L2 normalization.
For example: if I do it with norm,
a=-pi/2: pi/100: pi/2;
cf=((1+cos(a))/2).^50;
cf=cf/norm(cf);
plot(a,cf)
This plot slowly goes to 1 as I increase the order. Please see the picture. That is what I want. But the maximum value changes with sample size. In my project, the function is continuous, i.e. the sample size is infinity. orders.png
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.
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!

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Phased Array System Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!