# 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.

how can chip be made from sand
is this allso about nanoscale material
Almas
are nano particles real
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Got questions? Join the online conversation and get instant answers!