In MATLAB, create a row vector containing sampled values of a 1 Hz sinusoid with
ID: 3348846 • Letter: I
Question
In MATLAB, create a row vector containing sampled values of a 1 Hz sinusoid with a sample rate of 20 Hz. The span of the sinusoid should be at least 500 periods in length (i.e. 500 seconds-long rectangular window). The amplitude of the sinusoid should be unity. Process this signal with the function agc. Choose output_power-0.1, mu-0.001, lenavg-100, and complete the following tasks: Slide 2: Use MATLAB's subplot command, to create subplots of the sinusoidal signals at the input and output of the AGC amplifier, respectively. Label your axes, label your subplots, and include your name in the title, e.g. ("Input and output signals Jane Doe") . .Slide 3: Present a plot of the gain parameter a as a function of time. Interpret and explain the meaning of this plot. Slide 4: Use MATLAB to numerically calculate the signal power of the sinusoidal signals at the input and output of the AGC amplifier, respectively. At each discrete time, the average signal power Pav[k] at each sample k should be calculated based on current data point and the previous 99 data points (for a total of 100 data points). Use MATLAB's subplot command, to create subplots of these moving averages. Label your axes, label your subplots, and include your name in the title, e.g. ("Input and output average signal power-Jane Doe"). You should see the input power is approximately 0.5 and the output signals' power should tend to 0.1 W. Explain why this is · o Hint on calculating the power: Suppose you sample a signal to obtain an array of N samples: x[0], x], ..., x[N]. The average signal power Pav of these Nsamples can be computed numerically by summing the square of each sample, and dividing by the number of samples N., i.e, avExplanation / Answer
%Coding Running and working on Matlab 2018a
freq = 1;
sF = 20;
Time = 500;
x = 0.05:1/sF:Time;
y = sin (2*pi*freq*x.'); % Input Signal of AGC
outputP = 0.1;
H = comm.AGC('AveragingLength',100,'DesiredOutputPower',outputP,'AdaptationStepSize',0.001); % AGC designed according to parameters
agcOut = H(y); %Output of AGC
figure;
subplot(2,1,1)
plot(x,y) % Plotting Input Signal of AGC
title('Subplot 1: Input Signal of AGC')
xlabel('Time --> ') % x-axis label
ylabel('Input Signal Magnitude') % y-axis label
subplot(2,1,2)
plot(x,agcOut) % Plotting Ouput Signal of AGC
title('Subplot 1: Output Signal of AGC')
xlabel('Time --> ') % x-axis label
ylabel('AGC Output Signal Magnitude') % y-axis label
figure;
gainParameter = agcOut./y;
plot(x,gainParameter) % Plotting Gain Parameter 'a'
title('Gain Parameter')
xlabel('Time --> ') % x-axis label
ylabel('Gain') % y-axis label
%The Gain is a ratio of the output signal to the input signal of the AGC.
%%Input Power
pTotal = 100;
signal = y;
signalSq = signal.*signal;
powerIn = movsum(signalSq,[pTotal-1 0]) / pTotal ; % Tends towards 0.5 for T tending to 500 secs
%%Output Powper
pTotal = 100;
signal = agcOut;
signalSq = signal.*signal;
powerOut = movsum(signalSq,[pTotal-1 0]) / pTotal ; % Tends towards 0.1 for T tending to 500 secs
figure;
subplot(2,1,1)
plot(x,powerIn) % Plotting Input Signal of AGC
title('Subplot 1: Input Signal Power of AGC')
xlabel('Time --> ') % x-axis label
ylabel('Input Signal Power') % y-axis label
subplot(2,1,2)
plot(x,powerOut) % Plotting Ouput Signal of AGC
title('Subplot 1: Output Signal Power of AGC')
xlabel('Time --> ') % x-axis label
ylabel('Output Signal Power') % y-axis label
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.