April S. Henry
Advanced Numerical Methods-CE8213
500518364
Problem 5
The boundary fluxes and the reaction term can be used to develop the discrete form of
the advection-diffusion equation for the interior volumes as
dividing both sides by x,
For the first
April S. Henry
Advanced Numerical Methods-CE8213
500518364
Assignment #1
Answer to question 1
Computer Program-Matlab
function [su,sd]=Summation(N)
%This function summation is designed to compute the geometric of the function
f(N) summing from smallest to
April S. Henry
Advanced Numerical Methods-CE8213
500518364
Assignment #2
Answer to problem 5.18 b
Bisection program to determine temperature as a function of oxygen saturation concentration
using Matlab given 10 iteration calculated above.
The function is
Problem 4
Matlab Codes
Matlab Code using Runge-Kutta method
function [ t,y ] = rk4sys( dydtsys,tspan,y0,h)
% Fourth order runge- kutta method used to compute the set of ODE's
% h= step size
ti=tspan(1);% initial time
tf=tspan(2);% final time
t=(ti:h:tf)';
Problem 3
Matlab Codes
Matlab Code using Runge-Kutta method
function [ x,y ] = rk4( dydx,xspan,y0,h)
% Fourth order runge- kutta method used to compute the set of ODE's
% h= step size
xi=xspan(1);% initial x
xf=xspan(2);% final x
x=(xi:h:xf)';
n = length(
Problem 2
Deriving the functions and jacobian used in the computer program
f0 =y0=0
fi = - + +a =0
fn-1 =yn-1-1=0
i=1
f1 = - + +a =0
from the above function yo=0
f1 is reduced to
f1 = - + +a =0
a= 1
f1 = + + = 0
i=2
f2 = - + +a =0
from the above function
Assignment #5
Problem 1
Computer Program-Matlab Code
function [x,iter] = newtonm(x0,f,J)
% Multiple Newton-Raphson method applied to a
% system of linear equations f(x) = 0,
% x(0)=x(1);x(1)=x(2)
% f= y
%y0=f1;y1=f2
% given the jacobian function J, with
%
April S. Henry
Advanced Numerical Methods-CE8213
Problem 25.18a
Decomposition of second order differential into two first order differential
dx1/dt = x2
dx2/dt = -(5*x(1)*x(2)-(x(1)+7)*sin(w*t)
Problem 25.18b
Computer Program-Matlab
function af = Problem4
Problem 25.17
Computer Program-Matlab
function dy=dydt(t,y)
dy=-0.06*sqrt(y);
end
%euler.m
dt=0.5;
max=60;%Maximum time for tank drainage
n=max/dt+1;
t=zeros(1,n);
y=zeros(1,n);
t(1)=0;
y(1)=3;
for i=1:n
y(i+1)=y(i)+dydt(t(i),y(i)*dt; %Eulers formula
t(i+
% The Newton-Raphson method for solving equations of the form f(x)=0.
% We use the central difference approximation of the derivative by calling
% the function central_diff.m.
% -% INPUT: Anonymous function f, and the first guess at a solution, x0.
% e_di