% This script will carry out error analysis 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; T=150e-6; % 150us f = 1/T; Vin = @(t) 6*cos(2*pi*f*t); current_initial=0; current_exact = @(t) -- Vout_exact = @(t) -- [time_array, Vout_array] = ralston(R, L, Vin, current_initial, step, data_points*step); for j=1:data_points error_array(j) = Vout_exact(time_array(j)) - Vout_aray(j); end plot(log(time_array),log(error_array));