
% Coefficients
R = 30; % Ohms
L = 2e-6; % Henries
C = 3e-9; % Farad

% Matrix
% Uses x = [iC; vC]
A = [-R/L, -1/L; 1/C, 0];
B = [1/L; 0];
C = [0, 1];
D = [0];

% step(A, B, C, D);
% impulse(A, B, C, D);

%%
eig(A)

% Plot the behavior "manually" for some initial condition
x0 = [0; 1]; % Initial condition [iC; vC]

N = 2000;
tmax = 2.5e-6;

y = zeros(N, 1);
t = linspace(0, tmax, N);

for ii = 1:N
    y(ii) = C * expm(A*t(ii)) * x0;
end

hold on;
plot(t, y); %, '-g');
% xlim([0, tmax]);
