Numerical methods have wide applicability across many scientific, mathematical, and engineering disciplines and are most often employed in situations where working out an exact answer to the problem by another method is impractical.

helpful for multidimensional integration. Let us consider the following example where we have to compute the integral Observe that if we take then we can write the above integral as Since p(x) is equal to the probability distribution function p Y (y) of an exponential random variable Y given as the integral can also be seen as the following expectation which can be computed using a Monte Carlo method. Note that the initial integral has no random variable in it, but we created a dummy random

for each type of problem. MATLAB provides built-in functions for these optimization problems and we will explore some of these functions. Since most of these functions follow a similar syntax, we will first learn a unified approach to understand how to use built-in optimization functions and then see some examples of a few of these functions. Defining an Objective Function First we need to define our objective function in the form of a MATLAB function. All optimization functions in MATLAB

partial derivatives of the dependent variables. MATLAB provides the inbuilt pdepe partial differential equation solver to solve any system of parabolic and elliptic PDEs which can be written in the form with initial conditions u(x,t o) = u o(x) and boundary conditions of the form p(x,t,u) + q(x,t)f (x,t,u,u x ) = 0 at x = x l & x = x u . Here c,f,s,p,u and q are some functions with appropriate inputs. We will start with a standard example taken from the MATLAB documentation on pdepe. Let us

Similarly zeros will create an all zero matrix, eye will create an identity matrix and rand will create a matrix whose entries are random values between 0 and 1. Other Variable Types We saw that MATLAB creates variables of type matrix. Until now, we have only seen variables containing numerical matrix values. In this section, we will meet a few other types of variables that MATLAB implements. Character Variables A character variable is a string containing characters. Remember that a single

transfer function. Consider two systems defined as which can be represented as S1num=1;S1den=[1 3];S1=tf(S1num,S1den); S2num=1;S2den=[1 1];S1=tf(S2num,S2den); The S3 resulting from the serial connection of these two systems is given as and can be computed in MATLAB as S3=S1*S2; We see that the * operation is overloaded here to give the cascaded output of two systems. Similarly, you can call the step function over a system to evaluate its step response. y=step(S1); All these