summaryrefslogtreecommitdiff
path: root/coursework17/error_script.m
blob: 2744ba9ba94b4f23096002cf866ff19646585d7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
% 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));