# Solve math problems – numerical methods

Resources > Matlab > Solve math problems – numerical methods

Also see Resources > Matlab > Diffusion & Heat Transfer for more numerical method examples

For links below to PDF and text files, hit the browser “back” button to return here.

 Topic MATLAB Examples Simultaneous linear equations Notes – Material Balances Himmelblau & Riggs (7th ed) Workbook 7.4 problem statement screen shot – for Workbook 7.4 m-file – for Workbook 7.4 Root of nonlinear equation M-file link. As example, solve van der Waal’s equation for molar volume using Newton’s method, fzero(), fminbnd(), interval halving or bisection, successive approximation, the SYMBOLIC toolbox and, since this happens to be a polynomial, roots(). Fit polynomial function to data using “linear regression” Notes 1 – fit polynomial to data Notes 2 – fitting equations to data a straight line is a graph of polynomial of order 1 Fit a polynomial to data using polyfit, polyval and linear algebra Fitting nonlinear equation to data using “nonlinear regression” (“least squares fit”) (yes, this example can be inverted and linearized but the methods work on nonlinear equations) Problem statement Problem solution with function lsqcurvefit. You must have the Optimization Toolbox installed in order to use lsqcurvefit. > main file > function file Problem solution with function fminsearch > main file > function file Differentiation and integration (quadrature) of data Integration of data (quadrature) Differentiation of data – RTD tracer experiment FreeMat users: search for Freemat note in file Differentiation of data from Batch Reactor Integrate one Ordinary Differential Equation (ODE) Integrating one ODE using Euler’s method Using Matlab’s ode45 function > main file > derivative function file Integrate two coupled ODE’s See notes in cell above Integrating two ODEs using Euler’s method Using Matlab’s ode45 function > main file > derivative function file Integrate Partial Differential Equations (PDE) using the finite-difference method Transient 1D diffusion – code, plots and notes Transient 1D diffusion – code only