UNIT 3
1. Write a MATLAB script to calculate the factorial of a number using a loop.
2. Create a function that takes a number as input and returns whether it is prime or
not.
3. Write a program to calculate the sum of all elements in a given matrix.
4. Generate the Fibonacci series up to the nth term using a script.
5. Write a Matlab program Root Finding by Bisection Method.
6. Write a script to check if a given string is a palindrome.
7. Write a MATLAB script to calculate the roots of a polynomial using roots function
8. Implement Simpson’s rule to approximate the integral of a given function.
9. Find the eigenvalues and eigenvectors of a given square matrix.
10. Write the output for this program along with suitable explanation.
a = 3;
b = 9;
c = 2*a+b^2-a*b+b/a-10
10. Perform matrix multiplication and verify properties like associativity.
11. Plot the sine and cosine functions on the same graph for x from 0 to 2π.
12. Plot the derivative of f(x) =sin(x)+cos(x) over the interval [0,2π].
2 2
13. Create a 3D surface plot for the function z=x −y .
14. Plot the function y = 2 sinx with grids. Then, keep the first graph and plot a
second function given by y = coscos (x) within the same interval. Insert the labels
for each data set, as well.
15. Generate a scatter plot for random data points and label the axes.