Documente Academic
Documente Profesional
Documente Cultură
( >
(
= =
( <
3
Interesting Functions in Matlab
Saw-toothed Wave Functions
The default saw-toothed has a period of 2t and an be
thought of as follows:
x = 0:0.0001:20;
plot( x, sawtooth( x ) )
ylim( [-1.2 1.2] )
sawtooth( 0 )
ans = -1
sawtooth( pi )
ans = -1
( )
sawtooth 2 1
2
x x
x
t t
(
=
(
4
Interesting Functions in Matlab
Saw-toothed Wave Functions
A second argument indicates what proportion into the
interval [0, 2t] the peak of the tooth appears
The defualt is identical to sawtooth( x, 1 )
x = 0:0.0001:20;
plot( x, sawtooth( x, 0.5 ) )
ylim( [-1.2 1.2] )
0.5
5
Interesting Functions in Matlab
Saw-toothed Wave Functions
The last interesting case has the parameter as 0:
x = 0:0.0001:20;
plot( x, sawtooth( x, 0 ) )
ylim( [-1.2 1.2] )
square( 0 )
ans = 1
square( pi )
ans = -1
( )
sawtooth , 0 1 2
2
x x
x
t t
(
= +
(
6
Interesting Functions in Matlab
The Cardinal Sine Function
The sinc function is not periodic and is defined as:
x = -10:0.0001:10;
plot( x, sinc( x ) )
ylim( [-1.2 1.2] )
( )
( )
1 0
sinc
sin
0
x
x
t
x
t
t
t
=
=
=
7
Interesting Functions in Matlab
The Triangular Pulse Function
The triangular-pulse function is not periodic and is
defined as:
x = -2:0.0001:2;
plot( x, tripuls( x ) )
ylim( [-1.2 1.2] )
( )
0 1
1 1 0
tripuls
1 0 1
0 1
x
x x
x
x x
x
s
+ < s
=
< s
<
8
Interesting Functions in Matlab
Summary
We have quickly covered some of the special functions
in Matlab
square, sawtooth, tripuls and sinc
This will be used later in applications
9
Interesting Functions in Matlab
References
[1] Jack Little, Cleve Moler, and Steve Bangert, Matlab, Mathworks, 1984-
2012.
10
Interesting Functions in Matlab