Numerical Analysis With Matlab2020

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By FUEL DEPT
F
FUEL DEPT
Community Contributor
Quizzes Created: 1 | Total Attempts: 102
Questions: 20 | Attempts: 102

SettingsSettingsSettings
Numerical Analysis With Matlab2020 - Quiz

LECTURER LAETH ALI HUSSEIN
FUEL DEPT
Third CLASS


Questions and Answers
  • 1. 

    [1  0   0 1  1   1 1  2/3    4/9    ] [x0,x1,x2]' [1 0 0.5]' find x1  x2 x3

    • A.

      1  - 1/4    -3/4

    • B.

      1   0.25    -0.75

    • C.

      1  1/4    3/4

    • D.

      -1  - 1/4    3/4

    Correct Answer
    A. 1  - 1/4    -3/4
  • 2. 

    Function f=new4(x)     f=x.^3-4*x+3;               end Apply the following in commands windows and find the results feval(@new4,[-3  -2 -1 0 ]

    • A.

       -12     3    6     3

    • B.

       -12     6     3    3

    • C.

       -12     6    6     3

    • D.

       -11     3    6     3

    Correct Answer
    A.  -12     3    6     3
    Explanation
    The given code defines a function called "new4" which takes an input "x" and returns the value of x^3 - 4x + 3. The "feval" function is then used to evaluate the "new4" function for the input values [-3, -2, -1, 0]. The results of these evaluations are -12, 3, 6, and 3 respectively.

    Rate this question:

  • 3. 

    Find the results of the following series  E=1+1/2!+1/3!+1/4!+1/5! take x=2:5  5! is equal 5*4*3*2*1

    • A.

      1.7167

    • B.

      -1.7167

    • C.

      2.1667

    • D.

      0.6617

    Correct Answer
    A. 1.7167
    Explanation
    The given series is a sum of reciprocals of factorials. The factorial of a number is the product of all positive integers less than or equal to that number. In this case, the factorial of 5 is 5 * 4 * 3 * 2 * 1 = 120.

    By substituting x=2:5 into the series, we get:
    E = 1 + 1/2! + 1/3! + 1/4! + 1/5!
    = 1 + 1/2 + 1/6 + 1/24 + 1/120
    = 1 + 0.5 + 0.1667 + 0.0417 + 0.0083
    = 1.7167

    Therefore, the correct answer is 1.7167.

    Rate this question:

  • 4. 

    Function f=new(x)    f=x.^3-4*x+3;     end Apply the following in commands windows and find the results fzero(@new,[-3  -2 ]

    • A.

      -2.0328

    • B.

      -2.6745

    • C.

      -2.3028

    • D.

      -2.2830

    • E.

       -2.4567

    Correct Answer
    E.  -2.4567
    Explanation
    The answer -2.4567 is obtained by applying the fzero function to the function "new" with an initial interval of [-3 -2]. The fzero function is used to find the root of a given function within a specified interval. In this case, the function "new" is a cubic function defined as f(x) = x^3 - 4x + 3. By applying the fzero function, it is determined that the root of this function within the interval [-3 -2] is approximately -2.4567.

    Rate this question:

  • 5. 

    In polynomials find [x1 x2 x3 ]from the following equations X1+x2+x3=6 2x1+x2+x3=7

    • A.

      [1.000   5.000]'

    • B.

      [1.000   5.600]'

    • C.

      [0.200   5.000]'

    • D.

      [5.000   0.4000]'

    • E.

      Non,solve in above 

    Correct Answer
    A. [1.000   5.000]'
  • 6. 

    Solve the following equation dy/dx=x^2+y^2 Initial values y(0) =1 , x=[0  1] n=10 xn= x0+ n h find y(0.4) use Euler method

    • A.

      1.627

    • B.

      1.357

    • C.

      1.573

    • D.

      1.735

    Correct Answer
    C. 1.573
    Explanation
    Using the Euler method, we can approximate the value of y(0.4) by iteratively calculating the slope at each step and updating the y-value. Starting with the initial value y(0) = 1, we can calculate the slope at x = 0 using the given equation dy/dx = x^2 + y^2. Plugging in x = 0 and y = 1, we get dy/dx = 0^2 + 1^2 = 1.

    Using this slope, we can calculate the approximate value of y at x = 0.1 by adding the product of the slope and the step size (h) to the previous value of y. Continuing this process for the given number of steps (n = 10) and using the step size (h = 0.1), we can find the approximate value of y at x = 0.4.

    After performing the calculations, the approximate value of y(0.4) is found to be 1.573, which matches the given answer.

    Rate this question:

  • 7. 

    In Runge-Kutta method  k2= 

    • A.

      K2=hf(xn+h/2,yn+k2/2)

    • B.

      K2=hf(xn+h/2,yn+k1/2)

    • C.

      K2=hf(xn+h,yn+k1/2)

    • D.

      K2=hf(xn+h/2,xn+k1/2)

    Correct Answer
    B. K2=hf(xn+h/2,yn+k1/2)
    Explanation
    In the Runge-Kutta method, k2 is calculated by evaluating the derivative of the function at the midpoint of the interval, using the value of k1 divided by 2. This is represented by the equation k2 = hf(xn+h/2, yn+k1/2). This approach helps to improve the accuracy of the approximation by taking into account the average slope over the interval.

    Rate this question:

  • 8. 

    Solve the following equation dy/dx=x^2+y^2 Initial values y(0)=1 x=[0  1] h=0.05 xn= x0+ n h find y(0.4) use Euler method

    • A.

      1.276

    • B.

      1.627

    • C.

      1.276

    • D.

      0.627

    Correct Answer
    B. 1.627
    Explanation
    Using the Euler method, we can approximate the value of y(0.4) by iteratively calculating the values of y at each step. Starting with y(0) = 1, we can calculate y(0.05) using the equation dy/dx = x^2 + y^2. Plugging in x = 0 and y = 1, we get dy/dx = 0^2 + 1^2 = 1. Multiplying this by the step size h = 0.05, we get dy = 0.05. Adding this to the initial value of y, we get y(0.05) = 1 + 0.05 = 1.05. We repeat this process for each step until we reach x = 0.4, and the approximate value of y(0.4) using the Euler method is 1.627.

    Rate this question:

  • 9. 

    Approximate the area under the curve y=2^x between x=−1 and x=3 using the Trapezoidal Rule with n=4 subintervals. rule Tn=Δx/2[f(x0)+2f(x1)+2f(x2)+2f(x3)+f(xn)].

    • A.

      Tn=10.25

    • B.

      Tn=9.25

    • C.

      Tn=11.25

    • D.

      Tn=12.52

    Correct Answer
    C. Tn=11.25
    Explanation
    The Trapezoidal Rule is a method used to approximate the area under a curve by dividing the interval into smaller subintervals and approximating each subinterval with a trapezoid. The formula for the Trapezoidal Rule is given as Tn = Δx/2[f(x0) + 2f(x1) + 2f(x2) + 2f(x3) + f(xn)], where Δx is the width of each subinterval and f(xi) represents the value of the function at each subinterval. In this case, the Trapezoidal Rule with n=4 subintervals was used to approximate the area under the curve y=2^x between x=-1 and x=3, resulting in Tn=11.25.

    Rate this question:

  • 10. 

    Nsteps=  in Euler method

    • A.

      (xn+x0)/(h)+1

    • B.

      (xn-x0)/(h+1)

    • C.

      (xn+x0)/(n)+1

    • D.

      (xn-x0)/(hn)+1

    • E.

      (xn-x0)/(h)+1

    Correct Answer
    E. (xn-x0)/(h)+1
    Explanation
    The given expression, (xn-x0)/(h)+1, represents the number of steps in Euler's method. In Euler's method, the number of steps is determined by the difference between the final and initial values (xn-x0), divided by the step size (h), and then adding 1. This is because each step in Euler's method approximates the solution at a specific point, and the total number of steps is determined by dividing the interval between the initial and final values by the step size, and then adding 1 to account for the initial value. Therefore, (xn-x0)/(h)+1 correctly represents the number of steps in Euler's method.

    Rate this question:

  • 11. 

    X = linspace (0 ,2*pi ,41);  y = tan( x ); plot (x , y);

    • A.

      Option 1

    • B.

      Option 2

    • C.

      Option 3

    • D.

      Option 4

    Correct Answer
    D. Option 4
    Explanation
    The given code snippet generates a plot of the tangent function for values of x ranging from 0 to 2*pi. The plot command is used to create the graph. Therefore, the correct answer is Option 4, which indicates that the code will plot the tangent function.

    Rate this question:

  • 12. 

    What is the function of @

    • A.

      To write comment

    • B.

      To define symbolic 

    • C.

      To define a variable 

    • D.

      To create handle of a function

    Correct Answer
    D. To create handle of a function
    Explanation
    The "@" symbol in programming languages, such as in Python, is used to create a handle or reference to a function. It allows you to pass functions as arguments, store them in variables, or return them as values. This is commonly used in scenarios where you want to pass a function as an argument to another function or when you want to store a function in a variable for later use.

    Rate this question:

  • 13. 

    To plot the following  function y = myfunc ( x ) y = 2* x .^2 - 3* x + 1; end  

    • A.

      Plotf(@myfunc,[-2 2])

    • B.

      Plot(@myfunc,[-2 2])

    • C.

      Fplot(@(x) myfunc ,[-2 2])

    • D.

      Fplot(@myfunc,[-2 2])

    Correct Answer
    D. Fplot(@myfunc,[-2 2])
    Explanation
    The correct answer is fplot(@myfunc,[-2 2]). This is the correct answer because the fplot function is used to plot a function, and the @myfunc specifies the function to be plotted. The range of x values to be plotted is specified as [-2 2].

    Rate this question:

  • 14. 

    Express the this function in matlab f(x)=ex +sin(5x)      

    • A.

      F=@exp(x)+sine(5*x)

    • B.

      F=@(x)exp(x)+sine(5*x)

    • C.

      F=@(x)exp(x)+sin(5*x)

    • D.

      F=@x exp(x)+sin(5*x)

    Correct Answer
    C. F=@(x)exp(x)+sin(5*x)
    Explanation
    The correct answer is f=@(x)exp(x)+sin(5*x). This is the correct way to express the given function in MATLAB. The "@" symbol indicates that it is an anonymous function, and the "exp(x)" represents the exponential function and "sin(5*x)" represents the sine function. The plus sign is used to add the two functions together.

    Rate this question:

  • 15. 

    What is function of (;)

    • A.

      It is a rows separator

    • B.

      It is a columns separator:

    • C.

      It is a array separator:

    • D.

      It is a functions separator:

    Correct Answer
    A. It is a rows separator
    Explanation
    The semicolon (;) is used as a row separator in certain programming languages or data formats. It is commonly used to separate multiple statements or expressions within a single line of code. In this context, it helps to organize and structure the code by indicating the end of one row or statement and the beginning of the next. By using semicolons, developers can write more concise and readable code, especially when dealing with complex or lengthy statements.

    Rate this question:

  • 16. 

    X1 + x2 = 2 4x1 + 5x2 = 10

    • A.

      [0  2]

    • B.

      [2   1]

    • C.

      [0  0  2]

    • D.

      [0  2  1 ]

    Correct Answer
    A. [0  2]
    Explanation
    The given system of equations can be written in matrix form as Ax = b, where A is the coefficient matrix, x is the variable matrix, and b is the constant matrix. The coefficient matrix A is [[1, 1], [4, 5]], the variable matrix x is [x1, x2], and the constant matrix b is [2, 10]. To find the solution x, we can use matrix algebra and solve for x by multiplying both sides of the equation by the inverse of A. The inverse of A exists because the determinant of A is not zero. The solution x will be [0, 2].

    Rate this question:

  • 17. 

    To print a new line in fprintf functions

    • A.

      /n

    • B.

      /t

    • C.

      \n

    • D.

      %

    Correct Answer
    C. \n
    Explanation
    The correct answer is "\n". In the fprintf function, "\n" is used to print a new line. It is a special character that represents the end of a line and causes the cursor to move to the beginning of the next line when printed.

    Rate this question:

  • 18. 

    What are %4.2f means in fprintf function 

    • A.

      20.111

    • B.

      00111.02

    • C.

      21.01

    • D.

      0113.01

    • E.

      Option 5

    Correct Answer
    C. 21.01
    Explanation
    The %4.2f in the fprintf function is a format specifier that is used to print a floating-point number with a width of 4 characters and a precision of 2 decimal places. In the given answer, 21.01 is the number that would be printed using this format specifier.

    Rate this question:

  • 19. 

    To add comments 

    • A.

      /*   comments */

    • B.

      %  comments 

    • C.

      //  comments 

    • D.

      ''   comments "

    Correct Answer
    B. %  comments 
  • 20. 

    We run this commands isnumeric(32) the results is

    • A.

      0

    • B.

      1

    • C.

      Nan

    • D.

      Inf

    Correct Answer
    B. 1
    Explanation
    The command "isnumeric(32)" is used to check if the given input, which is 32 in this case, is a numeric value. The result of this command is 1, which means that 32 is indeed a numeric value.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • May 31, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 26, 2020
    Quiz Created by
    FUEL DEPT
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.