Escolar Documentos
Profissional Documentos
Cultura Documentos
6
Example-1: Basic Polynomial Functions
-------------poly.m-----------------% Learning polynomial functions clc format format compact p=[1 -5 6] a=roots(p) b=poly(a) c=polyval(p,[1 2 5]) fn=inline('x.^2-5.*x+6') d=fn([1 2 5]) x=0:0.2:1 y=polyval(p,x) p1=polyfit(x,y,2) p2=polyfit(x,y,1) y1=polyval(p2,x) error=y-y1
_____________________________________
Exercise-1 The expression for p is given in terms of the symbolic variable x as: Example-2:Learning Symbolic Expressions P = 9*x^3 6*x^2 -2*x + 15 Solve the following equations for x and Evaluate the value of p for the following values of x: y: x2-2*x-2*x*y+4*y = 0 x = -5, 3, 7.5, 15 x^2-6*x+5 = 0 Solution:
>> syms x y s >> s= solve(x^2-2*x-2*y*x+4*y, x^2-6*x+5) s = x: [2x1 sym] y: [2x1 sym] >> s.x ans = [ 1] [ 5] >> s.y ans = [ 1/2] [ 5/2] __________________________________________
d 3x 2 dx
2* x 5
Further, find the value of Y at x = 5.5. Exercise-3 Find the determinant of A using symbolic tool, for = 45 degrees, where A is given as: A =
3 sin( ) cos(2 )
cos( 2 ) sin( )
Second-Order Exercise-4 Use the MATLAB symbolic tool to solve the following set of equations: 7x + 14y 6z = 95 Solve the following differential equation with the given initial 12x 5y + 9z = -50 conditions: Example-3:Solving a differential equation:
d2y dx 2
2.
dy 3. y dx
Abhay Classes, 137-A, Street-29, Smriti Nagar, Bhilai, e-mail: info@abhayclasses.co.in, (M) 9806870268
Abhay Classes, 137-A, Street-29, Smriti Nagar, Bhilai, e-mail: info@abhayclasses.co.in, (M) 9806870268