Download Symbolic Math Toolbox User's Guide

Transcript
Calculus
the case when a is a positive real number, you can calculate the integral as
follows:
syms a positive;
The argument positive in the syms command restricts a to have positive
values. Now you can calculate the preceding integral using the commands
syms x;
f = exp(-a*x^2);
int(f,x,-inf,inf)
This returns
ans =
1/(a)^(1/2)*pi^(1/2)
If you want to calculate the integral
∞
∫e
– ax
2
dx
–∞
for any real number a, not necessarily positive, you can declare a to be real with
the following commands:
syms a real
f=exp(-a*x^2);
F = int(f, x, -inf, inf)
MATLAB returns
F =
PIECEWISE([1/a^(1/2)*pi^(1/2), signum(a) = 1],[Inf, otherwise])
You can put this in a more readable form by entering
pretty(F)
{
1/2
{ pi
{ ----{
1/2
{ a~
{
signum(a~) = 1
2-15