Electric Circuit - Differential Equations - Ex - 1
Electric Circuit - Differential Equations - Ex - 1
Vo
1
I L 3VC Vin (t )
5
Plot the desire response the state variables: VC , I L , and the output Vo for each of the three cases of input voltages
with an amplitude (1 volt) and frequency ( Hz): square wave , saw tooth wave, and sine wave. (0⩽ t ⩽50 sec)
[t,x] = ode45('electricity_System_1',tspan,x0);
figure (1)
subplot(4,1,1),plot(t,Vin,'r');
grid on
ylim([-(Amp+.2) (Amp+.2)]) %
xlabel('time [sec]'); ylabel('Vin [Volt]');
subplot(4,1,2),plot(t,x(:,1),'b');
grid on
xlabel('time [sec]'); ylabel('Vc [Volt]');
subplot(4,1,3),plot(t,x(:,2),'Color',[0.47,0.67,0.19]);
grid on
xlabel('time [sec]'); ylabel('IL [Amp]');
subplot(4,1,4),plot(t,Vo,'k');
grid on;
xlabel('time [sec]'); ylabel('Vo [Volt]');
function dx = electricity_System_1(t,x)
Figure (b): results for saw tooth wave input Figure (c): results for sine wave input