% Frequency Response Script % This script will plot the magnitude and phase response of a low-pass RC filter % using the parameters defined below. The time axis will be plotted % in terms of cut-off frequency (i.e. normalized by 1/(RC)). % % Written by Kevin D. Donohue 9-7-2004 (donohue@engr.uky.edu) R = 1000; % Resistance value C = 1e-6; % Capacitor value A = 10; % Voltage (max amplitude) of input step co = 2*pi/(R*C); % Compute circuits cut-off frequency (3 dB down point). % Time axis Limits in terms of time constants num_o_co = 3; % Number of cut_off frequency intervals for length of frequency axis sample_int = .001; % frequency inteval as a fraction of the cut-off frequency w = [0 : co*sample_int : num_o_co*co]; % Create frequency axis from 0 s = j*w; % put frequency on imaginary axis mvc = abs(A ./ (1+s/co)); % Compute magnitude response figure % Open new figure window for plot plot(w/co, mvc); % Normalize frequency axis by cut-off and plot response xlabel('Frequency in number of 3dB Cut-off Frequency Values') % Label x-axis ylabel('Magnitude') % Label y-axis figure % Open new figure window for plot pvc = phase(A ./ (1+s/co)); % Compute phase response plot(w/co, pvc*180/pi); % Normalize frequency axis by cut-off, convert radians % to degress and plot response xlabel('Frequency in number of 3dB Cut-off Frequency Values') % Label x-axis ylabel('Degrees') % Label y-axis