You are on page 1of 4

EX NO: 4

SOLVING MATLAB EXPRESSIONS II

1. Write a MATLAB statement to calculate sum of the series


S=1CODE:
x=2
S= 1-((x^2)/2)+((x^4)/24)+((x^6)/720)+((x^8)/40320)
OUTPUT:

2. The values of a,b,c,d are -190.5*


, 14.6*103,0.00056 and 456.28 repectively
Write a program to evaluate the following statements
a) F1=ab/cd+a*b
b) F2=a/bc-d/a
CODE:
a= -190.5*10^(-2);
b= 14.6*103;
c= 0.00056;
d= 456.28;
F1=((a*b)/(c*d))+(a*b)
F2=(a/b*c)-(d/a)
OUTPUT:

MATRIX
1. Create a matrix A
CODE:
A= [1 1 1;2 2 2;3 3 3]
OUTPUT:

2. Create the following matrix:


CODE:
B= [1 -2;sqrt(3) exp(1)]
OUTPUT:

3. Create various sub-matrix for the given 3X3 matrix: (Hint: A(1:2,2:3 ) Explanation: displays
the elements starting from 1st row 2nd element to 2nd row 3rd element
CODE:
A[1:2,2:3]

OUTPUT:

4. Use size() command to calculate the size of the matrix.


CODE:
size(A)
OUTPUT:

You might also like