DERIVATIVES AND DIFFERENTIAL EQUATIONS - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

DERIVATIVES AND DIFFERENTIAL EQUATIONS

Description:

The most widely used application of derivative is in finding the extremum (max ... two differentials, dy and dx, using diff, to arrive at the derivative ... – PowerPoint PPT presentation

Number of Views:75
Avg rating:3.0/5.0
Slides: 38
Provided by: BijanMo3
Category:

less

Transcript and Presenter's Notes

Title: DERIVATIVES AND DIFFERENTIAL EQUATIONS


1
DERIVATIVESANDDIFFERENTIAL EQUATIONS
  • June 23,99

i

v
-
2
WHAT IS A DERIVATIVE?
  • Derivative of f(x) at xa is given by f(a)

yf(x)
f(ah)
f(a)
a
ah
3
SIGNIFICANCE OF DERIVATIVE
  • In the limit, derivative at xa is equal to the
    slope m of the tangent line at a.

yf(x)
f(a)
a
ah
4
APPLICATIONS OF DERIVATIVE
  • The most widely used application of derivative is
    in finding the extremum (max or min) points of a
    function.
  • If a function has a local extremum at a number c
    then either f(c)0 or f(c) doesnt exist

5
CRITICAL NUMBERS
  • A number c in the domain of a function f is a
    critical number of f if either f(c)0 or f(c)
    does not exist

f(c)0
xc
6
DERIVATIVES IN MATLABdiff
  • MATLAB computes two differentials, dy and dx,
    using diff, to arrive at the derivative
  • If x and y are input array of numbers
  • dydiff( y)
  • dxdiff(x)
  • Then,
  • yprimediff(y)./diff(x)

7
How diff works
  • Take the array y3 5 7 5 9
  • diff(y) simply is the pairwise differences, i.e.
  • diff(y)5-3 7-5 5-7 9-5
  • which is equal to
  • diff(y)2 2 -2 4
  • Naturally, there is one fewer term in diff(y)
    than it is in y

8
Using diff to find derivatives
  • Let y10 25 30 50 10 for x1 2 3 4 5
  • Then
  • diff(y)15 5 20 -40
  • diff(x)1 1 1 1 1
  • Dividing term-by-term
  • yprime15 5 20 -40

One fewer component
9
WORKING WITH humps
  • humps is a built-in MATLAB function, like peaks
    and is given by

10
HOW IT LOOKS
11
Try it!derivative of humps
  • First, we must know how humps was created in
    order to know dx
  • x00.011dx in this case is 0.01
  • yhumps(x)
  • Now use
  • dydiff(y)
  • dxdiff(x)

yprimedy./dx
12
PLOT OF dy/dx
Function peaks
Deriv. goes to 0
13
Finding critical pointstheory vs. application
  • To find max. or min.we should look for instances
    where y0.
  • This is where the difference between textbook
    methods and the real world shows up.
  • To see for yourself look for instances where
    yprime0.

14
Where are the zeros?
  • If you did the search right, you will realize
    that nowhere in yprime you can actually see a
    zero
  • Since there are no points where y is exactly
    zero, we should look for points of transition
    from positive to negative, i.e. sign changes



15
Zero crossing and sign transition
  • In Matlab, all derivatives are discrete. Some are
    positive, some negative but no zeros
  • Since derivative goes from to -, we can infer
    that it went to zero somewhere in between

Zero crossing
16
FINDING ZERO CROSSINGS
  • There are two ways to find where a function
    crosses zero
  • 1. Numerical
  • 2. Algebraic(polynomial fitting)

17
ZC USING ARRAY OPERATION
  • To find where a sign transition takes place,
    multiply two consecutive numbers in the
    derivative array. If there is a sign change, the
    product is negative
  • 10 15 16 9 -4 -3 -4 -9

Zero crossing
X
X
X
X
X
X
X
- -
18
MATLABs WAY
  • Let x be an n element arrayx1,x2,,xn. To
    generate the zero crossing array, do
  • yx(1n-1).x(2n)
  • Algebraically, this is what is happening
  • yx1x2 x2x3 ,..., xn-1xn

19
Try it!
  • Evaluate humps in the range x0 to 1 in
    increments of 0.01
  • This gives you a 1x101 array. Find yprime. This
    is now a 1x100 array
  • Find where in this 101 positions sign changes
    occur

20
LOCATING SIGN CHANGES
  • Just look for instances of negative sign in the
    zero crossing array

1st0.29 2nd0.63 3rd0.88
21
CLOSER LOOK
Sign change
22
SECOND ZC
23
THIRD ZC
24
Differential Equations
i

v
-
25
Simplest Diff.Eq
  • A first order differential equation is of the
    form
  • y dy/dxg(x,y)
  • We are looking for a function y such that its
    derivative equals g(x,y)

26
FEW EXAMPLES
  • Find y that such that
  • y 3x2
  • y y
  • y (2x)cos2y
  • Answers
  • yx3
  • yexp(x)
  • y???

27
SOLVING ODEs USING MATLAB
  • MATLAB solves ordinary DE in two ways
    1)numerical and 2)symbolic
  • For numerical solution use
  • x,yode23(function,a,b,initial)
  • See next slide for usage

28
EXPLAINING ode23
  • Here are the elements of
  • x,yode23(function,a,b,initial)
  • function - this is g(x,y) in y g(x,y). Must
    be written as a separate MATLAB function
  • a - left point of the interval
  • b - right point of the interval
  • initial - initial condition, i.e. y(a)

29
USING ode23
  • Lets solve y 3x2
  • First write a function as follows
  • function yprimeanything(x,y)
  • yprime3x.2
  • Then call
  • x,yode23(anything,2,4,0.5)
  • y is the solution. Plot x vs.y

30
RC CIRCUIT
  • Equation describing a source-free RC circuit is

vc
C
R
ic
31
SOLVING FOR VOLTAGE
  • The analytical solution is
  • where Vo is the initial voltage across the
    capacitor

32
MATLABs WAY
  • To use ode23, we need to cast the problem in the
    form of y g(x,y)
  • Here, y is vc. . Therefore,
  • vc-(1/RC)vc
  • With RC10-3, write a function like
  • function vcprimerc(t,vc)
  • vcprime-(103)vc

33
SOLVING FOR vc
  • Use ode23 as follows
  • t,vcode23(rc,0,1,2)

34
CIRCUIT WITH FORCED RESPONSE
  • Take the following RL circuit(p.497)

i
35
WHAT IS i ?
  • From circuits analysis we know

36
SOME NUMBERS
  • Let R2 ohm, L1 H and vs10cos3t
  • Here is what we have
  • Zsqrt(94)sqrt(13)
  • Vm10
  • ?56.3o

37
EXERCISE- VERIFY WITH MATLAB
  • Use ode23 to solve for current. Match the two
    results, graphically, to see if the amplitude,
    phase and frequencies match the theoretical result
Write a Comment
User Comments (0)
About PowerShow.com