load 'definitions.gnuplot' #LOUDSPEAKER MODEL---use your model from Lab 5 Zloud(f) = Rnom+Zlsemi(f,Lhi,Lhipow)+Zpar(Rs,Zpar(Zl(f,Ls),Zc(f,Cs))) Rnom=7.738 Lhi= 1.107e-2 ; Lhipow = 0.627 Ls=2.72e-3 ; Cs=418.08e-6 ; Rs=15.501 # CHOOSE A SERIES RESISTOR IF YOU PLAN TO MEASURE LOUDSPEAKER CURRENT Rseries = 0.0 # extra resistor for displaying current on scope # real power into loudspeaker with no filter (voltage from amplifier V at frequency f) nofilter_power(V,f)=real_power(V*divider(Rseries,Zloud(f)), Zloud(f)) # LC FILTER MODEL Lfilt=220e-6; Rfilt=0.252 # parameters for AIUR-06-221 inductor # voltage divider with Lfilt+Rfilt and (Cfilt || loudspeaker+resistor) gain(f,Lfilt,Rfilt,Cfilt) = \ divider(Zl(f,Lfilt)+Rfilt, Zpar(Zloud(f)+Rseries,Zc(f,Cfilt))) # total impedance, in case we want to plot that also Ztotal(f,Lfilt,Rfilt,Cfilt) = Zl(f,Lfilt)+Rfilt + Zpar(Zloud(f)+Rseries,Zc(f,Cfilt)) # real power into loudspeaker with voltage from amplifier V at frequency f # using the LC filter loud_power(V,f,Lfilt,Rfilt,Cfilt) = \ real_power(V*gain(f,Lfilt,Rfilt,Cfilt)*divider(Rseries,Zloud(f)), \ Zloud(f)) # CHOOSE YOUR SUPPLY VOLTAGE V_supply=4 # +/- power supply voltage V_RMS = V_supply/sqrt(2) # RMS voltage for largest sine wave from supply half_power=0.5*loud_power(V_RMS,300,Lfilt,Rfilt,3.3e-6) # half the power from 300Hz set title sprintf("Low-pass LC filter for loudspeaker with %.3gohm series resistor",Rseries) set yrange [1e-4:40] set ylabel sprintf('Real power to speaker with +- %.3gV supply [W]',V_supply) plot half_power title sprintf("half-power=%.3gW",half_power), \ nofilter_power(V_RMS,x) title "no filter", \ loud_power(V_RMS,x,Lfilt,Rfilt,0.1e-6) title sprintf("L=%.3guH C=%.3guF", Lfilt*1e6, 0.1), \ loud_power(V_RMS,x,Lfilt,Rfilt,1e-6) title sprintf("L=%.3guH C=%.3guF", Lfilt*1e6, 1), \ loud_power(V_RMS,x,Lfilt,Rfilt,2.2e-6) title sprintf("L=%.3guH C=%.3guF", Lfilt*1e6, 2.2), \ loud_power(V_RMS,x,Lfilt,Rfilt,3.3e-6) title sprintf("L=%.3guH C=%.3guF", Lfilt*1e6, 3.3), \ loud_power(V_RMS,x,Lfilt,Rfilt,4.7e-6) title sprintf("L=%.3guH C=%.3guF", Lfilt*1e6, 4.7), \ loud_power(V_RMS,x,Lfilt,Rfilt,10e-6) title sprintf("L=%.3guH C=%.3guF", Lfilt*1e6, 10)