MATLAB Learning Note (iii): Symbolic calculation (integral + derivative)

Source: Internet
Author: User
Tags cos diff

2.3.1 Symbolic calculus

Find the Limit

Limit (F,x,a) for x in F (x) to approximate the limits of a

For example:

>> Clear
>> syms k x
>> Lim_t=limit ((1-1/x) ^ (k*x), x,inf)
 
lim_t =
 
1/exp (k)

Derivative number

diff (F,x,n) to find n-derivative of f (x)

>> Clear
>> syms x
>> Dfdx=diff (x^3,x,1)
 
DFDX =
 
3*x^2

Note that the Findsym acknowledgement is automatically called when X is default on the upper formula, and N defaults to the default N=1

There are also several functions:

Jacobian (f,v) The Jacobian matrix of the multivariate vector function f (v) (Advanced)

Taylor (F,n,x,a) expands f (x) into a power series (Taylor series) at X=a


Symbolic summation of 2.3.2 sequences/series

S=symsum (F,x,a,b) asks F (x) from A to B and

X Findsym is automatically confirmed by default, and a, B can default to [0,x-1]

When F is a matrix, the sum will be individually

>> clear
>> syms t k
>> f=[t,k^3];
>> S=simple (Symsum (f))
 
s =
 
[T^2/2-T/2, K^3*t]

2.3.3 Symbol integral

Int (f,x) to calculate indefinite integral of f (x) dx

int (f,x,a,b) definite integral from A to B

Similarly, x default findsym automatically confirms that a, B can be any value or symbol expression

>> Clear
>> syms x
>> f=sqrt ((x+1)/x)/x;
>> S=int (f,x), s=simple (s)
 
s =
 
-(1/x + 1) ^ (1)-2*atan ((1/x + 1) ^ () *i) *i
 
 
s =
 
- ()-2*atan ((1/x + 1) ^ (*i) *i

。。 The result is how the whole complex.

Matrix Quadrature

>> Clear
>> syms a b x
>> F=[a*x,b*x^2;1/x,sin (x)];
>> disp (' The ANS is ');
the ANS is >> int (f)
 
ans =
 
[(a*x^2)/2, (B*X^3)/3]
[    log (x),   -cos (x)]
 
>> Pretty (int (f))
 
  +-                 -+ 
  |      2        3   | 
  |   A x      b x    | 
  |   ----,    ----   | 
  |    2        3     | 
  |                   |  | Log (x),-cos (x)  | 
  +-                 -+

Feel pretty () a bit uglier.

You can also ask for multiple integrals.

>> Clear
>> syms x y
>> int (int (x*y,y,2,3), x,1,2)
 
ans =
 
15/4


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.