Assignment #2
Assignment #2
College of Engineering
Consider the next circuit which represents a step-down converter and by using Matlab
programming
Is Io L
+
Sw 10 mH
100 V
v s D
+- Vo R
10 ohm
-
a) For a 50 % duty cycle and if the switching frequency is varied between 500 Hz to 5000
Hz in step of 1 Hz:
- draw in one page but in separate figures, the average load voltage versus the switching
frequency, the ripples current in the load current versus the switching frequency and
the average load current versus the switching frequency.
b) For a 1 kHz switching frequency and if the duty cycle is varied between 0 to 100 % in step
of 1 % :
- draw in one page but in separate figures, the average load voltage versus the switching
frequency, the ripples current in the load current versus the switching frequency and
the average load current versus the switching frequency.
% Parameters
Vs = 100; % Supply voltage in volts
D = 0.5; % Duty cycle
R = 10; % Load resistance in ohms
L = 10e-3; % Inductance in henries
f = 500:1:5000; % Frequency range
T = 1 ./ f; % Period
% Calculated values
Vo_avg = D * Vs * ones(size(f)); % Constant average output voltage
Delta_I = (Vs * D * (1 - D)) ./ (L .* f); % Correct ripple formula
Io_avg = Vo_avg ./ R; % Constant output current
% Plotting
figure;
subplot(3,1,1);
plot(f, Vo_avg, 'b', 'LineWidth', 1.5);
xlabel('Switching Frequency (Hz)');
ylabel('Average Output Voltage (V)');
title('Average Load Voltage vs. Switching Frequency');
grid on;
subplot(3,1,2);
plot(f, Delta_I, 'r', 'LineWidth', 1.5);
xlabel('Switching Frequency (Hz)');
ylabel('Ripple Current (\DeltaI) (A)');
title('Ripple Current vs. Switching Frequency');
grid on;
subplot(3,1,3);
plot(f, Io_avg, 'g', 'LineWidth', 1.5);
xlabel('Switching Frequency (Hz)');
ylabel('Average Load Current (A)');
title('Average Load Current vs. Switching Frequency');
grid on;
% Constants
Vs = 100; % Input voltage (V)
R = 10; % Load resistance (Ohm)
L = 10e-3; % Inductance (H)
fs = 1e3; % Fixed switching frequency (Hz)
% Output Calculations
Vo_avg = D * Vs; % Average Output Voltage
Delta_I = (Vs .* D .* (1 - D)) ./ (L * fs); % Ripple Current
Io_avg = Vo_avg ./ R; % Average Load Current
% Plotting
figure;
subplot(3,1,1);
plot(D*100, Vo_avg, 'b', 'LineWidth', 1.5);
xlabel('Duty Cycle (%)');
ylabel('Average Output Voltage (V)');
title('Average Load Voltage vs. Duty Cycle');
grid on;
subplot(3,1,2);
plot(D*100, Delta_I, 'r', 'LineWidth', 1.5);
xlabel('Duty Cycle (%)');
ylabel('Ripple Current (A)');
title('Ripple Current vs. Duty Cycle');
grid on;
subplot(3,1,3);
plot(D*100, Io_avg, 'g', 'LineWidth', 1.5);
xlabel('Duty Cycle (%)');
ylabel('Average Load Current (A)');
title('Average Load Current vs. Duty Cycle');
grid on;