TP1: MATLAB Coding: Bjective
TP1: MATLAB Coding: Bjective
TP1: MATLAB Coding: Bjective
OBJECTIVE
In this TP, basic knowledge in MATLAB will be reviewed such as using MATLAB Command line, MATLAB
Syntax, and MATLAB Script and Functions. From this TP, student able to
- Understand MATLAB
- Represent discrete-time signal
- Generate script and function using MATLAB IDE
Number
Variables
Operators
Also, punctuation marks (, , ;, :, etc.) have special meanings.
Number: MATLAB can handle all types of numbers, that is, integers, real numbers, complex numbers.
Variable: Basic variable is a matrix, or an array
Matrix
Scalar
Vector (column vector or row vector)
Operators:
Control flow
If-elseif-else-end (condition)
For…end loop
Example
K
x ( t )=∑ c k sin ( 100 πkt )
k=1
1
K=5; c k =
k
2. Plot x (t) and sin(100 πt ) during 1 second with sampling time of twice of the maximum
frequency
3. Implement function of the following basic functions
δ ( n )= {10 ,n=0
,n≠0
u ( n )= {10 ,, nn ≥≤ 00
4. Implement general form of impulse sequence and step sequence considering delay, n 0
x ( n )=δ ( n−n0 )
x ( n )=u( n−n 0)
5. Plot the following function of discrete-time signal using the definition in 3
x 1 ( n )=2 δ ( n−5 )−4 δ ( n+ 4 ): add multiple function of delta Kronecker delta function