% Vin = aI' + bI R = 0.5; % 0.5Ohm L = 0.0015; % 1.5mH data_points = 10000; % Go on for 8 time constants time_constant = L/R; step = time_constant*8/data_points; % Signal 1 Vin = 5.5V Vin = @(t) 5.5 + 0*t; % 5.5V current_initial=0; [t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step); plot(t, Vout); % Signal 2a Vin = 5.5*exp(-t^2/r) V Vin = @(t) 5.5*exp(-(t*160*10^(-6))^2) % 5.5V current_initial=0; [t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step); plot(t, Vout); % Signal 2b Vin = 5.5*exp(-t/r) Vin = @(t) 5.5*exp(-t*160*10^(-6)) % 5.5V current_initial=0; [t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step); plot(t, Vout); % Signal 3 T(1) = 20e-6; % 20us T(2) = 450e-6; % 450us T(3) = 1000e-6;% 1000us for j=1:3 f = 1/T(j); Vin = @(t) sin(2*pi*f*t); [t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step); plot(t, Vout); Vin = @(t) sawtooth(2*pi*f*t); [t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step); plot(t, Vout); Vin = @(t) square(2*pi*f*t); [t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step); plot(t, Vout); end