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

Minh Phượng

New member
What is the output of the following code?
Code:
Y=rectpulse(1,9);
t=0:1:8;
plot(t,y);
A. A rectangular pulse extending from 0 to 8 units in time
B. A rectangular pulse with increasing amplitude
C. Error
D. Cannot be determined
 
Answer: c
Explanation: The rectpulse() command returns a column vector. But t is a row vector. So, the plot command will create an error. This is why, we need to take the transpose of the y vector and put it in the plot command.
 

Tìm kiếm

Back
Top