This set of MATLAB Interview Questions and Answers for Experienced people focuses on “Integration – 2”.
1. How will we integrate a non-linear function, f, taken as an inline function?
Explanation: The function, f, will be taken as a string input. Hence, we cannot use the int command since it takes symbolic arguments while the class of our function is inline. Since the function is non-linear, we need to introduce it as a matrix to our quad() command. It takes string arguments so the correct answer should be quad(‘’).
2. The correct way of using the quad command while integrating an inline non-linear function is ___________
Explanation: The inline function, being a non-linear function and saved as an inline class, will be given as a string argument to the quad() command. Due to its non-linear nature, it has to be placed like a matrix. quad(‘’) will only take the function but the function is non-linear so it will show an error. quad([‘’]) is wrong because the ‘’ should comprise the entire function, hence it should be outside . quad() is syntactically wrong.
3. What is the class of the result of quad() command?
Explanation: The class of the result of quad command is double. This is an in-built command in MATLAB and it will give the answer in the format double.
4. What is the output of the following code?
Explanation: We need to declare x as a symbolic variable before using it in the int() command. The input argument to the int() command should be symbolic. The answer would be -23 if we had declared symbolic before using the int() command.
5. The int function returns a constant of integration for indefinite integration.
Explanation: The int function does not return a constant of integration after doing indefinite integration. It will only show the particular integral after integrating the input function.
6. The answer for indefinite integration in MATLAB is __________
a) The only possible particular integral
b) One of the many possible integrals
Explanation: Indefinite integrals can have many possible solutions. Only of the solution is provided by the int() function.
7. What is the output of the following code?
Explanation: We have to give symbolic arguments to our int() command. Since we have not declared x as symbolic, the result of the int command will be an error. If the ‘x’ was declared as symbolic, the result would’ve been x^4/12.
8. We cannot perform problems regarding area under a curve in MATLAB.
Explanation: We can do problems pertaining to finding the area under a curve in MATLAB. This is because methods of definite and indefinite integration are present in the form of commands in MATLAB. This makes MATLAB so versatile.
9. What is the class of the result of quadl() command?
Explanation: The class of the result of quadl() command is double since it computes definite integrals only. We would get the result as symbolic if we compute indefinite integration using the int command.
10. To find the particular integral of a differential equation, we use the _____
a) int() command
b) quad() command
c) ODE solver
d) Depends on the differential equation
Explanation: We can find the particular integral for the differential equation dy⁄dx=5x by using int(5*x). We would need an ODE solver when the differential equation is long and has multiple orders. Hence, it depends on the differential equation, how we want to select our command.
Sanfoundry Global Education & Learning Series – MATLAB.
To practice all areas of MATLAB for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.