What is the output of the following code? [code]Y=rectpulse(1,9); p=y’; t=0:1:9; plot(t,p);[/code]

What is the output of the following code?
Code:
Y=rectpulse(1,9);
p=y’;
t=0:1:9;
plot(t,p);
A. u(t)-u(t-9)
B. u(t) till 9 units in time
C. Error
D. Cannot be determined
 
Answer: b
Explanation: The length of p is 9 but that of t is 10. This will result in an error in the plot command. The t vector should be from 0 to 8 or we can have rectpulse(1,10). If we want u(t)-u(t-9), the latter is to be chosen. But here, the plot command will give an error.
 

Tìm kiếm

Back
Top