Question
Parabolic PDEs 1. Implement in MATLAB/Octave or Python a finite difference method to solve a parabolic PDE problem in 1D, which is defined as: ut(x,
Parabolic PDEs 1. Implement in MATLAB/Octave or Python a finite difference method to solve a parabolic PDE problem in 1D, which is defined as:
ut(x, t) = c 2 uxx (x, t) in [a, b] [0, T] with u(a, t) = 0, u(b, t) = 0 and u(x, 0) = f (x).
You are required to write MATLAB/Octave function FDparabolic.m with the following input-output format:
function [x,t,u] = FDparabolic( a, b, n, T, m, c, f ) or for Python def FDparabolic( a, b, n, T, m, c, f ): ...
where the inputs a and b are the extrema, n is the number of subintervals, T is the final time, m is the number of time steps, c is the coefficient c and f is the initial value. The outputs x contains the nodes of partition, t contains the nodes in time and u contains the values of the computed solution at the nodes
.
2. Use the implemented code FDparabolic.m to compute the solution of the problem:
ut(x, t) = uxx (x, t), u(x, 0) = sin(x) in [0, ] [0, 1] with u(0, t) = u(, t) along the boundary. Use 20 nodes in space and 100 in time.
3. Produce a visualisation of the solution using gnuplot or MATLAB/Octave command surf( t, x, u )
3.3.2 Hyperbolic PDEs 1. Implement in MATLAB/Octave or Python a finite difference method to solve a hyperbolic PDE problem in 1D, which is defined as: utt(x, t) = c 2 uxx (x, t)
in [a, b] [0, T] with u(a, t) = 0, u(b, t) = 0 and u(x, 0) = f (x), ut(x, 0) = g(x).
You are required to write MATLAB/Octave function FDparabolic.m with the following input-output format: function [x,t,u] = FDhyperbolic( a, b, n, T, m, c, f, g )
Or in Python def FDhyperbolic( a, b, n, T, m, c, f, g ):.
.. where the inputs a and b are the extrema, n is the number of subintervals, T is the final time, m is the number of time steps, c is the coefficient c, f is the initial value for u and g is the initial value for ut . The outputs x contains the nodes of partition, t contains the nodes in time and u contains the values of the computed solution at the nodes.
2. Use the implemented code FDhyperbolic.m to compute the solution of the problem: ut(x, t) = 4uxx (x, t), u(x, 0) = sin(x), ut(x, 0) = 0
in [0, ] [0, 1] with u(0, t) = u(, t) along the boundary. Use 20 nodes in space and 40 in time. 3. Produce a visualisation of the solution using gnuplot or MATLAB/Octave command surf( t, x, u )
3.3.3 Numerical Instability Investigate the effects on the solutions of various combinations of number of subintervals n and time steps m by using the functions developed (FEparabolic.m and hyperbolic.m) to compute the solutions of u(0.5, 0.5) with time steps of 10, 100, 200 and 400; and subintervals of 4, 16 and 32, thus complete a table similar to that shown in Table 3 for each case.
m n u(/2, 0.5)
10 4
16
32
100 4
16
32
200 4
16
32
400 4
16
32
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started