MATLAB_Online_Tutorial_corrected - CHEE 222 PROCESS...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CHEE 222: PROCESS DYNAMICS AND NUMERICAL METHODS Prepared by Kunal Karan 1 Solving Nonlinear Equation(s) in MATLAB 1 Introduction This tutorial helps you use MATLAB to solve nonlinear algebraic equations of single or multiple variables. 2 Writing MATLAB functions In order to use the MATLAB solvers, you must first be able to write MATLAB functions. There are two different methods to create a function - (a) inline command, and (b) Matlab editor 2.1 The ‘ inline ’ command The inline command can be used for simple, one-line functions. For example, to create f ( x ) = x 3 - 5 x 2 -x + 2 : >> f = inline (‘ x^ 3 -5*x^2 - x + 2’) f = Inline function: f(x) = x^3-5*x^2-x+2 You can now evaluate the function value at any given x. For example, to evaluate the function value at x = 4, simply type ‘ f (4) ’ at Matlab command line. EDU>> f(4) ans = -18 2.2 The MATLAB editor The editor allows the user to write functions of any length and/or complexity. 1. Set the current working directory to your diskspace e.g. “c:\CHEE222\Matlab\Iamhappy\Temp\”
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/14/2011 for the course FIN 5515 taught by Professor Staff during the Spring '10 term at FSU.

Page1 / 5

MATLAB_Online_Tutorial_corrected - CHEE 222 PROCESS...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online