0% found this document useful (0 votes)
16 views4 pages

Question Bank

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Question Bank

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Question Bank

Matlab Programming_2024-2025
1. If 𝑝 = 𝑥 4 − 12𝑥 3 + 25𝑥 + 116 and 𝑟 = 𝑥 + 1, find 2 from 3:
a. The roots of a polynomial 𝑝
b. Multiply the two polynomials 𝑝𝑟
c. The differentiation of the a polynomial 𝑝
2. Write two ways to display the following matrix:
3 4 5 6 7
( )
13 14 15 16 17
3. What is the output of the following code? t=0:0.001*pi:pi/2;
plot(t,sin(t),*);
4. Using the Matlab built-in functions (zeros, ones, eye) from the
0 0 0 1 1
0 0 0 1 1
1 0 0 0 0
following matrix: 0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
(0 0 0 0 1 )
5. Give Matlab commands to plot on the same figure the two functions:
𝑓 = 3𝑡 2 + 2𝑡 − 0.5
Where the variable t varies from 0 to 10 in step of 0.5 without need to
care about the dimension of t.
-Draw the function f in red dashdot style and the function g in green
star.
-Give title to your graph and label the axes, and adds grid line to your
plot.
6. What is the size and length of x?
−10 −11 −12 −13 −14 −15
x= ( )
−2 −1 0 1 2 3
7. Write the Matlab command for the following line:
𝑌 = |𝑋𝑒 𝑎𝑋 − cos 𝑏𝑋 | for a=11, b=π and X={2,4,6,8} without need to
care about the dimension of X.
8. Find the integral or the area under a function if 𝑥 is varied from 0 to
100 in steps of 1, and

𝑦 = 30 − 60 cos(2𝜋/100𝑥)

9. Find: (1) the inverse of matrix A, and (2) delete the second column of
matrix A.

10. Use the “for” loop comment to find the 𝑥 array if:
𝑥 = 2 ÷ 3√(𝑚𝑛)2 , where m is varied between 1 to 10, while n is
varied between 1 to 5, and ÷ (right divide).

11. Write a program to find the Y value when:


2
−10 ≤ 𝑥 < 0
𝑥3
𝑌= 2 𝑥=0
3 0<𝑥≤7
{ √𝑥 2 + 4

12. Create a script file to generate (N X N) matrix using for loop


statement sin form like:
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
0 1 0 1 0
[1 0 1 0 1]
13. Write a program to generate the series (1, 2, 4, 8, … , 1024) and
display it as a vector using the while loop.
14. Create a function file, named Nmax should be written in a file
named Nmax.m. It takes three numbers as argument and returns
the maximum of the numbers.
15. Write a program to display the multiplication table using the while
loop.
16. Input numerical score between 0 and 100 and output “Pass” or
“Fail” using Algorithm and Flow chart.
17. Write an algorithm to read three numbers and find their sum.
18. Design an algorithm which generates even numbers between 1000
and 2000 and then prints them in the standard output. It should also
print total sum.
19. Design an algorithm with a natural number, n, as its input which
calculates the following formula and writes the result in the standard
output:

S = ½ + ¼ + … +1/n

20. Calculate the average from 25 exam scores using the Flowchart.
21. Draw a Flowchart to Find Square of an Integer Number.
22. Draw a flowchart to calculate the area of a triangle.

23. Calculate the average of 5-numbers using the Algorithm and the
Flowchart.
24. Draw the Flowchart to find the sum of first of first 50 natural
numbers.

25. Find the largest among three different numbers entered by the
user using algorithm and Flowchart.

26. Find all the roots of a quadratic equation ax2+bx+c=0.

27. Draw a Flowchart to Find a Number is Even or Odd

28. Check a Number is Positive or Negative using a Flowchart.

29. Find the biggest of three (3) Numbers using a Flowchart.

30. Use a Flowchart to read 10 numbers and find sum of even


numbers.

31. Find the area of the triangle where the three sides are given using
algorithm, flowchart and Matlab program.

32. Find the area and perimeter of the square using algorithm,
flowchart and Matlab program.

You might also like