# 0.5 Sampling with automatic gain control  (Page 17/19)

 Page 17 / 19

Typical output of agcgrad.m is shown in [link] . The gain parameter a adjusts automatically to make the overall power of the output s roughly equal to the specified parameter ds . Using the default values above, where the average power of $r$ is approximately 1, we find that $a$ converges to about $0.38$ since $0.{38}^{2}\approx 0.15={\mathbf{s}}^{2}$ .

The objective ${J}_{LS}\left(a\right)$ can be implemented similarly by replacing the avec calculation inside the for loop with

avec=[(s(k)^2-ds)*(s(k)^2)/a(k),avec(1:end-1)];

In this case, with the default values, $a$ converges to about $0.22$ , which is the value that minimizes the least square objective ${J}_{LS}\left(a\right)$ . Thus, the answer which minimizes ${J}_{LS}\left(a\right)$ is different from the answer which minimizes ${J}_{N}\left(a\right)$ ! More on this later.

As it is easy to see when playing with the parameters in agcgrad.m , the size of the averaging parameter lenavg is relatively unimportant. Even with lenavg=1 , the algorithms converge and perform approximately the same! This is because the algorithm updatesare themselves in the form of a lowpass filter. Removing the averaging from the update gives the simpler formfor ${J}_{N}\left(a\right)$

a(k+1)=a(k)-mu*sign(a(k))*(s(k)^2-ds);

or, for ${J}_{LS}\left(a\right)$ ,

a(k+1)=a(k)-mu*(s(k)^2-ds)*(s(k)^2)/a(k);

Try them!

Perhaps the best way to formally describe how the algorithms work is to plot the performance functions.But it is not possible to directly plot ${J}_{LS}\left(a\right)$ or ${J}_{N}\left(a\right)$ , since they depend on the data sequence $s\left[k\right]$ . What is possible (and often leads to useful insights)is to plot the performance function averaged over a number of data points (also called the error surface ). As long as the stepsize is small enough and the average is long enough,the mean behavior of the algorithm will be dictated by the shape of the errorsurface in the same way that the objective function of the exact steepest descent algorithm (for instance, the objectives [link] and [link] ) dictate the evolution of the algorithms [link] and  [link] .

The following code agcerrorsurf.m shows how to calculate the error surface for ${J}_{N}\left(a\right)$ : The variable n specifies the number of terms to average over, and tot sums up the behavior of the algorithm for all $n$ updates at each possible parameter value a . The average of these ( tot/n ) is a close (numerical) approximation to ${J}_{N}\left(a\right)$ of [link] . Plotting over all $a$ gives the error surface.

n=10000;                       % number of steps in simulation r=randn(n,1);                  % generate random inputsds=0.15;                       % desired power of output range=[-0.7:0.02:0.7];         % range specifies range of values of a Jagc=zeros(size(range));j=0; for a=range                    % for each value a  j=j+1;   tot=0;  for i=1:n     tot=tot+abs(a)*((1/3)*a^2*r(i)^2-ds);  % total cost over all possibilities  end   Jagc(j)=tot/n;               % take average value, and saveend agcerrorsurf.m draw the error surface for the AGC (download file) 

Similarly, the error surface for ${J}_{LS}\left(a\right)$ can be plotted using

tot=tot+0.25*(a^2*r(i)^2-ds)^2;  % error surface for JLS

The output of agcerrorsurf.m for both objective functions is shown in [link] . Observe that zero (which is acritical point of the error surface) is a local maximum in both cases.The final converged answers ( $a\approx 0.38$ for ${J}_{N}\left(a\right)$ and $a\approx 0.22$ for ${J}_{LS}\left(a\right)$ ) occur at minima. Were the algorithm to be initializedimproperly to a negative value, then it would converge to the negative of these values.As with the algorithms in [link] , examination of the error surfaces shows why the algorithms converge as they do. The parameter $a$ descends the error surface until it can go no further.

the art of managing the production, distribution and consumption.
what is economics
okk
damfash
marginal utility is the additional satisfaction one derives from consuming additional unit of a good or service.
Fred
It's the allocation of scarce resources.
Fred
Dishan
marginal utility is the additional satisfaction one derives from consuming additional unit of a good or service.
Fred
I know the definition, but I don't understand its meaning.
Dishan
what is the must definition of economic please?
Nurudeen
demand lfs
Alpha
Economics is derived from the word Oikonomia which means management of household things. Thus, Economics is a study of household things with the constrains of allocating scare resources.
Dishan
what is Open Market Operation
dominating middlemen men activities circumstances
what Equilibrium price
what is gap
mirwais
who is good with the indifference curve
Dexter
What is diseconomic
what are the types of goods
WARIDI
how can price determination be the central problem of micro economics
marginal cost formula
you should differentiate the total cost function in order to get marginal cost function then you can get marginal cost from it
boniphace
Foday
ok
Foday
how can price determination be the central problem if micro economics
simon
formula of cross elasticity of demand
what is ceteris paribus
what is ceteris parabus
Priyanka
Ceteris paribus - Literally, "other things being equal"; usually used in economics to indicate that all variables except the ones specified are assumed not to change.
Abdullah
What is broker
scor
land is natural resources that is made by nature
scor
What is broker
scor
what is land
kafui
What is broker
scor
land is natural resources that is made by nature
scor
whats poppina nigga turn it up for a minute get it
what is this?
Philo
am from nigeria@ pilo
Frank
am from nigeria@ pilo
Frank
so
owusu
what is production possibility frontier
owusu
it's a summary of opportunity cost depicted on a curve.
okhiria
please help me solve this question with the aid of appropriate diagrams explain how each of the following changes will affect the market price and quantity of bread 1. A
ok let me know some of the questions please.
Effah
ok am not wit some if den nw buh by tommorow I shall get Dem
Hi guys can I get Adam Smith's WEALTH OF NATIONS fo sale?
Ukpen
hello I'm Babaisa alhaji Mustapha. I'm studying Economics in the university of Maiduguri
Babaisa
okay
Humaira
my name is faisal Yahaya. i studied economics at Kaduna state university before proceeding to West African union university benin republic for masters
Faisal
Mannan
Wat d meaning of management
disaster management cycle
cooperate social responsibility
igwe
Fedric Wilson Taylor also define management as the act of knowing what to do and seeing that it is done in the best and cheapest way
OLANIYI
Difference between extinct and extici spicies
Got questions? Join the online conversation and get instant answers!