From 679a406ce3a866a8a2e66fbd09d7e5338096be2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nils=20Forss=C3=A9n?= Date: Mon, 31 Oct 2022 20:41:56 +0100 Subject: [PATCH] push --- Project/grafis.svg | 218 +++++++++++++++++++++++++++++++++++++++++++++ Project/grafus.svg | 218 +++++++++++++++++++++++++++++++++++++++++++++ Project/script.m | 9 +- 3 files changed, 442 insertions(+), 3 deletions(-) create mode 100644 Project/grafis.svg create mode 100644 Project/grafus.svg diff --git a/Project/grafis.svg b/Project/grafis.svg new file mode 100644 index 0000000..0b9d4dc --- /dev/null +++ b/Project/grafis.svg @@ -0,0 +1,218 @@ + + +11.11.21.31.41.51.61.71.81.92x0.50.520.540.560.580.60.620.640.660.680.7f(x)ApproxExact diff --git a/Project/grafus.svg b/Project/grafus.svg new file mode 100644 index 0000000..219db11 --- /dev/null +++ b/Project/grafus.svg @@ -0,0 +1,218 @@ + + +11.11.21.31.41.51.61.71.81.92x0.50.520.540.560.580.60.620.640.660.680.7f(x)ApproxExact diff --git a/Project/script.m b/Project/script.m index 1790f1f..970e81b 100644 --- a/Project/script.m +++ b/Project/script.m @@ -16,7 +16,7 @@ A %% Section 2 -N = 5; +N = 20; x = linspace(1,2, N); h = x(2) - x(1); @@ -48,12 +48,15 @@ answer = thomas(A, b); answer = [0.5;answer;log(2)]; plot(x, answer); + + hold on; real_values = zeros(N, 1); for i=1:N real_values(i) = (4/x(i)) - (2/(x(i)^2)) + log(x(i)) - (3/2); end plot(x, real_values); - - +xlabel("x"); +ylabel("f(x)"); +legend(["Approx"; "Exact"]); norm(answer - real_values, inf) \ No newline at end of file -- 2.30.2