This document provides an overview and summary of the topics that will be covered in a MATLAB programming course for first year B.Tech students taught by Dr. A. Saksena at the National Rail Transport Institute in Vadodara, India on June 4th, 2021. The topics include: applications of polynomials, representing and operating on polynomials, finding roots of polynomials, derivatives of polynomials, solving equations numerically using the fzero function, finding maxima and minima, numerical integration techniques, solving stiff equations, and an introduction to ordinary differential equations. Examples are provided for many of the concepts and techniques discussed.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
135 views32 pages
Matlab Polynomial Representation
This document provides an overview and summary of the topics that will be covered in a MATLAB programming course for first year B.Tech students taught by Dr. A. Saksena at the National Rail Transport Institute in Vadodara, India on June 4th, 2021. The topics include: applications of polynomials, representing and operating on polynomials, finding roots of polynomials, derivatives of polynomials, solving equations numerically using the fzero function, finding maxima and minima, numerical integration techniques, solving stiff equations, and an introduction to ordinary differential equations. Examples are provided for many of the concepts and techniques discussed.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32
Programming with Matlab
Course for B.Tech. I year
4th June 2021 Taught by Dr. A. Saksena National Rail Transport Institute Vadodara Applications: Solving Polynomials Polynomial Representation Roots of Polynomial Example Polynomial Addition Subtraction Polynomial Multiplication Polynomial Division Example Derivative of Polynomials Derivative of Polynomials Derivative of Polynomials Example Finding Zeros of Equation Arguments of fzero ● x is the solution, which is a scalar. ● Function is the function to be solved. It can be entered in several different ways: ○ The simplest way is to enter the mathematical expression as a string. ○ The function is first created as a user-defined function in a function file and then the function handle is entered. ○ The function is first created as an anonymous function and then the name of the anonymous function (which is the name of the handle) is entered Arguments of fzero ● x is the solution, which is a scalar or x is a vector of 2 values - interval in which zero of function lies. ● The function has to be written in a standard form. ● When a function is entered as an expression (string), it cannot include predefined variables. ● When a function has more than one solution, each solution can be determined separately by using the fzero function and entering values for x0 that are near each of the solutions. ● A good way to find approximately where a function has a solution is to make a plot of the function. Example Fzero Function ● The fzero command finds zeros of a function only where the function crosses the x-axis. The command does not find a zero at points where the function touches but does not cross the x-axis. ● If a solution cannot be determined, NaN is assigned to x. ● The fzero command has additional options is: ○ [x fval]=fzero(function, x0) assigns the value of the function at x to the variable fval. ● When the function can be written in the form of a polynomial, the solution, or the roots, can be found with the roots command ● The fzero command can also be used to find the value of x where the function has a specific value. This is done by translating the function up or down. Maxima & Minima Example Maxima Numerical Integration ● MATLAB built-in integration functions quad, quadl, integral and trapz. ● The quad, quadl and integral commands are used for integration when f(x) is a function. ● trapz is used when is f(x) is given by data points. Numerical Integration Stiff Equation In mathematics, a stiff equation is a differential equation for which certain numerical methods for solving the equation are numerically unstable, unless the step size is taken to be extremely small. It has proven difficult to formulate a precise definition of stiffness, but the main idea is that the equation includes some terms that can lead to rapid variation in the solution. Ordinary Differential Equations Ordinary Differential Equations Ordinary Differential Equations Ordinary Differential Equations Ordinary Differential Equations Example Function Evaluate Future Discussions File read write