diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-02-08 23:36:12 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-02-08 23:36:12 +0000 |
commit | 95b00f8755c5b5260b850438ffd47b17a3b0c807 (patch) | |
tree | d3ef45bf0fc03f4387a826a1ce221fa575a4b94f | |
parent | 0d24b5ac48cef35513a12d68c07320cc42e0bdfa (diff) | |
download | NumericalAnalysis-95b00f8755c5b5260b850438ffd47b17a3b0c807.tar.gz NumericalAnalysis-95b00f8755c5b5260b850438ffd47b17a3b0c807.zip |
Finished most of bonus too
-rw-r--r-- | Part 3/scripts/finite_script.m~ | 42 | ||||
-rw-r--r-- | Part 3/scripts/get_function.m~ | 7 |
2 files changed, 0 insertions, 49 deletions
diff --git a/Part 3/scripts/finite_script.m~ b/Part 3/scripts/finite_script.m~ deleted file mode 100644 index b568d1c..0000000 --- a/Part 3/scripts/finite_script.m~ +++ /dev/null @@ -1,42 +0,0 @@ -% This script implements the finite difference method to solve the heat -% equation - -clear; - -% Set the number of samples to take -N = 24; - -% Set the total time to run -m = 100; - -% Declare final size of matrix for speed -res = zeros(N+1, m+1); - -% Set v -v = 0.25; - -% Get h and k -h = 1/N; -k = h^2 * v; - -% Set Initial condition -res(:, 1) = get_function(h, 3); - -% Set boundary conditions -res(1, :) = abs(sin(2*pi*(0:1/m:1))); -res(N+1, :) = abs(sin(2*pi*(0:1/m:1))); - -% Calculate M+1 and plot it continuously -for c = 1:m - for i = 2:N - res(i, c+1) = v * res(i-1, c) + (1-2*v) * res(i, c) + v * res(i+1, c); - end -end - -for i = 1:(N/10-10) -plot(0:h:1, res()); -end -xlabel('x'); -ylabel('y'); -title('Plots of 1D Heat equation over time, constantly increasing boundary conditions'); -legend('m = 0', 'm = 1', '...', 'm = 99');
\ No newline at end of file diff --git a/Part 3/scripts/get_function.m~ b/Part 3/scripts/get_function.m~ deleted file mode 100644 index 769c3c9..0000000 --- a/Part 3/scripts/get_function.m~ +++ /dev/null @@ -1,7 +0,0 @@ -function y = get_function(bc0, bc1, h, f) - -if f == 1 -el - -end - |