MATLAB Questions and Answers Part-10

1. Which command is used to find the argument of a complex number?
a) atan2()
b) args()
c) abs()
d) cannot be determined

Answer: a
Explanation: The argument of a complex number is only the angle which satisfies the cartesian equations used to represent the real and imaginary part of the complex number. Thus atan2() is the in-built function to find the angle or the argument, in MATLAB. abs() is used to find the modulus of the complex number. args() is not a valid function in MATLAB.

2. What is the class of the complex number?
a) double
b) symbolic
c) character
d) array

Answer: b
Explanation: Since the complex number represented in MATLAB uses ‘i’ as a symbolic character, the class of any complex number is symbolic. It is not double and it is certainly not a character. An array is the general class of any variable or expression used in MATLAB.

3. What is the argument of -1-i in MATLAB?
a) -3*pi/4
b) pi/4
c) pi/4
d) -7*pi/4

Answer: a
Explanation: We observe that the complex number lies in the 3rd quadrant. Hence, we conclude that the argument of the complex number -1-i will be -3*pi/4 in MATLAB. -7*pi/4 is equivalent to -3*pi/4. Pi/4 is 5*pi/4 again.

4. What will be the output of the following code?
atan2(-1,1)
a) Error
b) -pi/4
c) -.7854
d) 0

Answer: c
Explanation: MATLAB returns all values of angles in radians. Hence, we will not see the output as -pi/4. The argument is -pi/4 but MATLAB will return -.7854.

5. The modulus of z, z conjugate and -z are not equal in MATLAB.
a) True
b) False

Answer: b
Explanation: The modulus of z, z conjugate and -z are equal. The magnitude of the modulus is always a positive number. It is independent of the positive or negative nature of the real and imaginary parts of the complex number.

6. What will be the output of the following code?
z=2+3i/(i99)
a) z conjugate
b) -z
c) -3+(2*i)
d) -1

Answer: d
Explanation: Following the precedence of operators,
2+3i/(i99)=2-3=-1. If we had given 2+3i within brackets, the value would have been -3+(2*i). The answer won’t be -z or z conjugate.

7. What is the output of the following code?
t=-i:.01*i:i; p=exp(2*t);plot(t,p)
a) a sinusoidal signal
b) an exponential signal
c) a discrete sinusoidal
d) no plot

Answer: d
Explanation: No plot will be generated. This is because colon operands cannot have complex arguments. It has to be real arguments.

8. What is the command used to check the real part of a complex number in MATLAB?
a) abs()
b) realc()
c) real()
d) cannot be checked

Answer: c
Explanation: The command to check the real part of any complex number is real(). It is an inbuilt function in MATLAB.

9. Which of the following command can be is used for complex arithmetic?
a) abs()
b) atan()
c) realc()
d) imagc()

Answer: a
Explanation: The abs() command is used to get the modulus of any complex number. The rest of the options are wrong because they should be ‘atan2()’, ‘real()’ and ‘imag()’.

10. What will be the output of the following code?
abs(i)
a) 1
b) -1
c) Error
d) i

Answer: a
Explanation: The abs command is used to find the magnitude of the complex argument given to it. Since magnitude is a positive value, the output will be a positive value and not -1.