# MATLAB Questions and Answers – Differentiation – 2

This set of MATLAB Questions and Answers for Experienced people focuses on “Differentiation – 2”.

1. While solving a differential equation, MATLAB will show us the ___________
a) General Solution
b) Particular Solution
c) Complementary function
d) Depends on the equation

Explanation: When we use dsolve to find the solution of an ordinary differential equation, we get the general solution of the equation. Now, this equation comprises of both the complementary function and the particular integral for the general solution. Hence, it is not that we only get the particular integral as a solution after using dsolve().

2. An example of a function whose derivative (any order) with respect to x is never 0, in MATLAB, is _______
a) sin(x)
b) xn
c) ex
d) does not exist

Explanation: It is not possible that the derivative of a function can never be 0. This is because there will always be a case where the derivative of the function becomes 0 for a certain value of x. This value of x can be real or imaginary.

3. The method of differentiation in MATLAB is pertinent for getting __________
a) Higher order differential equations
b) Lower order differential equations
c) Any order differential equation
d) A certain ordered differential equation, within a range

Explanation: MATLAB cannot find unnecessarily high ordered differential equation. It will compute a differential equation but the order of the differential equation is limited.

4. The output of the following code will be _____________

`syms t; dsolve(D(y,t)==2*t)`

a) Error
b) t2
c) t
d) t2+C

Explanation: The argument with dsolve() has D(y,t) will make no sense to the diff() command. Hence there will be an error, due the undefined variable D. If it was diff(y,t), the answer would have been t2+C.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

5. What is the co-efficient of the output of the code?

`diff(x90,39)`

a) 0
b) 90!/39!
c) 90!/50!
d) Error

Explanation: x90 gets differentiate 39 times. So the co-efficient will be 90*89*88*….*51. Hence this is represented as 90!/50!. The answer would have been 0 if the code was diff(x90,91).

6. What is the error in the following code?

`diff(‘x87+86’,23)`

a) No error
b) Arguments as strings
c) 23 is not given within a pair of inverted commas
d) There is no command as diff

Explanation: The command diff will not yield a function after taking the function with a pair of inverted commands. It will give an empty array as an output. No argument in diff() should be given within strings.

7. The ode 23 solver is for higher accuracy.
a) True
b) False

Explanation: The ode23 solver is inbuilt in MATLAB. It is a two to three order Runga-Kutta method solver and it is used for problems requiring lower accuracy.

8. The ode45 takes the function as ___________
a) Simple input argument
b) String argument
c) Input argument
d) Function argument

Explanation: The syntax of the ode45 solver is inbuilt in MATLAB. It takes the function as a string argument. The diff() command takes the function as a simple input argument.

9. What is the output of the following code?

`syms y; dsolve('y*diff(y)+5=x*exp(3)','y')`

a) Error
b) C + (x*(x*exp(3) – 10))/2
c) Cannot be determined
d) 0

Explanation: Our second argument in the dsolve() command is wrong. If we provide a second argument, it should specify the independent variable. But here we are differentiating y and specifying y as the independent variable. If we write dsolve(‘y*diff(y)+5=x*exp(3)’,’x’), the output would be C + (x*(x*exp(3) – 10))/2.

10. There are 7 ODE solvers in MATLAB.
a) True
b) False

Explanation: There are total 8 ODE solvers in MATLAB. They are inbuilt in MATLAB and each can be used for solving ODEs with initial values. They also provide varying accuracy.

Sanfoundry Global Education & Learning Series – MATLAB.

To practice all areas of MATLAB for Experienced people, 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]