<h2>LAB 10B: RC FILTERS WITH FREQUENCY RESPONSE EXPERIMENT</h2>
<sectionclass="problem">
<startouttext/>
<p>Note: Use this part of the lab to build your intuition about filters and frequency response, and to have fun with music! There are no responses that need to be checked.</p>
<p>Recall from the audio lab in Week 5 that the graph plots the selected voltages from the circuit shown below. This week the circuit is an RC filter. You can also listen to various signals by selecting from the radio buttons to the right of the graph. This way you can both see and hear various signals. You can use the sliders to the right of the circuit to control various circuit and input signal parameters. (Note that you can get finer control of some of the slider values by clicking on the slider and using the arrow keys). Recall that the parameter \(V_{MAX}\) sets the maximum range on the graph. You can also select an input voltage type (e.g., sine wave, square wave, various types of music) using the drop down menu to the right of the graph. When describing AC signals, the voltages on the sliders refer to peak-to-peak values.</p>
<p>1. To begin your first experiment, use the pull down menu to select a sine wave input. Then, adjust the sliders to these approximate baseline settings:
Observe the waveforms for \(v_{IN}\) and \(v_C\) in the graph. You can also listen to \(v_{IN}\) and \(v_C\). You will observe that the amplitude of \(v_C\) is slightly smaller than the amplitude of \(v_{IN}\).
<br/>
Compute the break frequency of the filter circuit for the given circuit parameters. (Note that the break frequency is also called the cutoff frequency or the corner frequency).
<br/>
Change the frequency of the sinusoid so that it is approximately 3 times the break frequency.
<br/>
Observe the waveforms for \(v_{IN}\) and \(v_C\) in the graph. Also listen to \(v_{IN}\) and \(v_C\). Think about why the sinusoid at \(v_C\) is significantly more attenuated than the original 1KHz sinusoid.
<br/>
Keeping the input signal unchanged, observe the waveforms for \(v_{IN}\) and \(v_R\) in the graph. Also listen to \(v_{IN}\) and \(v_R\). Think about why the sinusoid at \(v_R\) is significantly louder than the sinusoid at \(v_C\).</p>
<p>2. Next, use the pull down menu to select a music signal of your choice. Adjust the sliders to the approximate baseline settings:
Listen to the signals at \(v_{IN}\) and \(v_C\). Notice any difference between the signals?
<br/>
Next, increase the capacitance value and observe the difference in the sound of \(v_{IN}\) and \(v_C\) as the capacitance increases. You should notice that the higher frequency components of \(v_C\) are attenuated as the capacitance is increased.
Convince yourself that when the signal is taken at \(v_C\), the circuit behaves like a low-pass filter.</p>
<p>3. Re-adjust the sliders to the approximate baseline settings:
Try to create a high-pass filter from the same circuit by taking the signal output across a different element and possibly changing some of the element values.
//All generated sound (sine wave etc.) except square wave have sampling rate of 50000 Hz, length 1s. We will plot the first 10 ms. That's 500 samples for 10 ms and 500 px
elseif(musicType==4)//At 50000 Hz, square wave plays very poorly, we use 88200 Hz
{
xinc=10/882;
imax=882;
imult=1;
}
elseif(musicType==5||musicType==6||musicType==7||musicType==8)//All music files have a sampling rate 22050 Hz, length 20s. 20s/500px --> get value every 0.04 s ie every 882 samples.
//All generated sound (sine wave etc.) except square wave have sampling rate of 50000 Hz, length 1s. We will plot the first 10 ms. That's 500 samples for 10 ms and 500 px
elseif(musicType==4)//At 50000 Hz, square wave plays very poorly, we use 88200 Hz
{
xinc=10/882;
imax=882;
imult=1;
}
elseif(musicType==5||musicType==6||musicType==7||musicType==8)//All music files have a sampling rate 22050 Hz, length 20s. 20s/500px --> get value every 0.04 s ie every 882 samples.
{
xinc=20/500;
imax=500;
imult=882;
}
while(i<=imax)
{
ii=imult*i;
time[i]=x;
insig[i]=sp.inSignal.data[ii];
csig[i]=sp.outSignals[0].data[ii];
rsig[i]=sp.outSignals[1].data[ii];
x+=xinc;
i++;
}
sp.normalizeAllSounds();
//Bode plots
fc=getfCutoff(r,c);
vardf=magGraph.xspan/500;//magGraph is 500 pix large
//yi = alpha*x[i] + (1 - alpha)y[i-1] with alpha = dt/(RC + dt). dt is the sampling period. 0 <= alpha <= 1 is the smoothing factor. Exponentially-weighted moving average
//All generated sound (sine wave etc.) except square wave have sampling rate of 50000 Hz, length 1s. We will plot the first 10 ms. That's 500 samples for 10 ms and 500 px
elseif(musicType==4)//At 50000 Hz, square wave plays very poorly, we use 88200 Hz
{
xinc=10/882;
imax=882;
imult=1;
}
elseif(musicType==5||musicType==6||musicType==7||musicType==8)//All music files have a sampling rate 22050 Hz, length 20s. 20s/500px --> get value every 0.04 s ie every 882 samples.
{
xinc=20/500;
imax=500;
imult=882;
}
while(i<=imax)
{
ii=imult*i;
time[i]=x;
insig[i]=sp.inSignal.data[ii];
//MISSING I PLOT
rsig[i]=sp.outSignals[1].data[ii];
lsig[i]=sp.outSignals[2].data[ii];
csig[i]=sp.outSignals[3].data[ii];
x+=xinc;
i++;
}
sp.normalizeAllSounds();
//Bode plots
vardf=magGraph.xspan/500;//magGraph is 500 pix large
varinductance=[10,11,12,13,15,16,18,20,22,24,27,30,33,36,39,43,47,51,56,62,68,75,82,87,91,100,110,120,130,150,160,180,200,220,240,270,300,330,360,390,430,470,510,560,620,680,750,820,870,910,1000];//Note: 87 and 870?