What is the output of the following code? [code]T=0:1:9; stem(T);[/code]

What is the output of the following code?
Code:
T=0:1:9;
stem(T);
A. A ramp function
B. r[n]-r[n-9]-9u[n-9]
C. r[n]-r[n-9]
D. Error
 
Answer: b
Explanation: Since the ramp function extends upto infinity, it cannot be represented graphically. The above code plots the ramp function from 0 to 9 units in time but the signal is represented algebraically by option r[n]-r[n-9]-9u[n-9] only. At the instant n=9, the slope of the ramp function becomes 0 so the slop changes twice i.e. first r[n] gets reduced to a step function when r[n-9] gets subtracted from it. Then we simply subtract a step function of amplitude 9 from it to get the final function.
 

Tìm kiếm

Back
Top