MATLAB Questions and Answers – Complex Arithmetic

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Complex Arithmetic”.

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

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
View Answer

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) 5*pi/4
d) -7*pi/4
View Answer

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.
advertisement
advertisement

4. What will be the output of the following code?

atan2(-1,1)

a) Error
b) -pi/4
c) -.7854
d) 0
View Answer

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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

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.
advertisement

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
View Answer

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.
advertisement

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
View Answer

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
View Answer

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()
View Answer

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
View Answer

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.
Output: 1

Sanfoundry Global Education & Learning Series – MATLAB.

To practice all areas of MATLAB, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.