0% found this document useful (0 votes)
4 views

rd-ckt

This script analyzes the frequency response of a simple RC circuit by calculating the impedance of the capacitor and the total impedance of the circuit. It computes the transfer function, magnitude, and phase response, and then plots these responses on a logarithmic scale. The analysis demonstrates the low-pass filter characteristics of the RC circuit, highlighting attenuation of high frequencies and increasing phase lag with frequency.

Uploaded by

copeyic220
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

rd-ckt

This script analyzes the frequency response of a simple RC circuit by calculating the impedance of the capacitor and the total impedance of the circuit. It computes the transfer function, magnitude, and phase response, and then plots these responses on a logarithmic scale. The analysis demonstrates the low-pass filter characteristics of the RC circuit, highlighting attenuation of high frequencies and increasing phase lag with frequency.

Uploaded by

copeyic220
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

% Script to analyze the frequency response of a simple RC circuit

% Define the components R = 1000; % Resistance in Ohms C = 1e-6; % Capacitance in Farads

% Define the frequency range to analyze f_start = 1; % Start frequency in Hz f_end = 1e5; % End frequency in Hz
num_points = 200; % Number of frequency points f = logspace(log10(f_start), log10(f_end), num_points); %
Logarithmically spaced frequencies

% Calculate the impedance of the capacitor as a function of frequency Z_C = 1 ./ (1j * 2 * pi * f * C);

% Calculate the total impedance of the series RC circuit Z_total = R + Z_C;

% Calculate the transfer function H(f) = V_out(f) / V_in(f) % Assuming V_out is the voltage across the capacitor H_f =
Z_C ./ Z_total;

% Calculate the magnitude of the transfer function in dB magnitude_dB = 20 * log10(abs(H_f));

% Calculate the phase of the transfer function in degrees phase_degrees = angle(H_f) * 180 / pi;

% Plot the magnitude response figure; subplot(2, 1, 1); semilogx(f, magnitude_dB); xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)'); title('Magnitude Response of RC Circuit'); grid on;

% Plot the phase response subplot(2, 1, 2); semilogx(f, phase_degrees); xlabel('Frequency (Hz)'); ylabel('Phase
(degrees)'); title('Phase Response of RC Circuit'); grid on;

% Theory: This code analyzes a series RC circuit, which is a fundamental % building block in many electronic systems
(filters, timing circuits, etc.). % The impedance of a resistor is constant (R), while the impedance of a % capacitor is
frequency-dependent (Z_C = 1/(jωC), where ω = 2πf is the % angular frequency). The transfer function H(f) describes
how the circuit % modifies the amplitude and phase of an input signal at different frequencies. % For a low-pass RC
filter (V_out across C), the magnitude response shows % attenuation of high frequencies, and the phase response shows
a lagging % phase shift that increases with frequency.

You might also like