aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsupercalvinchan <cc6815@ic.ac.uk>2017-03-13 13:01:05 +0000
committerGitHub <noreply@github.com>2017-03-13 13:01:05 +0000
commit2ebe4bcbfd1b53169cec5c0035e7bed6570a96f4 (patch)
tree26b8fb5f45d2f81315448c9708c87e357a908b05
parent8cf2b242355ee01153ad021d293e7ee8232fa9e0 (diff)
downloadNumericalAnalysis-2ebe4bcbfd1b53169cec5c0035e7bed6570a96f4.tar.gz
NumericalAnalysis-2ebe4bcbfd1b53169cec5c0035e7bed6570a96f4.zip
Update error_script_heun.m
-rw-r--r--Part 1/error_script_heun.m9
1 files changed, 5 insertions, 4 deletions
diff --git a/Part 1/error_script_heun.m b/Part 1/error_script_heun.m
index bb511bd..2aeae88 100644
--- a/Part 1/error_script_heun.m
+++ b/Part 1/error_script_heun.m
@@ -18,13 +18,14 @@ func = @(t, iout) (vin(t) - iout*R) / L; % define func
vout = vin(t) - iout * R;
%obtaining the exact solution with favorite method
-exact= @(t) 0.07553*cos( 41883.7*(t) ) + 0.94901*sin( 41883.7*(t) ); % works for arrays
-
+i_{Exact} = g*(w*sin(w*t) + k*cos(w*t) - k*exp(-k*t))/(w^2 + k^2);
+exact = vin(t) - R*i_{Exact};
%error as a function of t
-error=exact-vout;
+error= exact - vout;
figure(1);
plot(t,error); %for heun
loglog(error);
-end \ No newline at end of file
+end
+