An interactive introduction to MATLAB

(Jeff_L) #1

88 additional exercises



  1. Functions
    In a low-pass RC filter (a filter that passes signals with low frequencies),
    the ratio of the magnitude of the voltages is given by:


RV=

∣∣

∣∣Vo
Vi

∣∣

∣∣=√^1

1 + (ωRC)^2

,

whereωis the frequency of the input signal. Write a user-defined function

R

Vi C Vo

Figure 28: A low-pass filter

that calculates the magnitude ratio. For the function name and arguments
useRV = lowpass(R,C,w). The input arguments are:Rthe size of the
resistor inΩ(ohms),Cthe size of the capacitor inF(Farads), andwthe
frequency of the input signal inrad/s. Write the function such thatw
can be a vector.
Write a script file that uses yourlowpassfunction to generate a plot of
RVas a function ofωfor 10 −^26 ω 6106 rad/s. The plot should have
a logarithmic scale on the x-axis (ω). When the script file is executed it
should prompt the user to enter values ofRandC. Run the script file
withR=1200 ΩandC=8 μF.
Free download pdf