0% found this document useful (0 votes)
60 views3 pages

Matrix Operations and Functions in MATLAB

This document contains examples of using MATLAB functions such as linspace, eig, lu, plot, subplot, and anonymous functions. It demonstrates operations on matrices like multiplication, inverse, transpose, and decomposition. It also shows defining functions to calculate density at different temperatures and plotting the results of functions.

Uploaded by

Hemanth Krishna
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views3 pages

Matrix Operations and Functions in MATLAB

This document contains examples of using MATLAB functions such as linspace, eig, lu, plot, subplot, and anonymous functions. It demonstrates operations on matrices like multiplication, inverse, transpose, and decomposition. It also shows defining functions to calculate density at different temperatures and plotting the results of functions.

Uploaded by

Hemanth Krishna
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

a. X=-3:100
Ans=linspace(-3,100,104)

inv(A) =
0.2353 -0.3529 0.2059

b. Y=1:0.5:20

0.2941 0.0588 -0.6176

Ans=linspace(1,20,39)

-0.1176 0.1765 0.1471


inv(B) =

2.

-0.0594 0.1485 0.0050

A=[4 3 7;1 2 7;2 0 4]

0.1485 0.1287 -0.2624

B=[1 5 8;7 2 3;4 0 6]

0.0396 -0.0990 0.1634

a. AB=A*B
AB =

det(B)= -202

53 26 83
43

det(A) = 34

9 56

rank(A) = 3
rank(B) = 3

18 10 40
BA=B*A
AB)'= B'*A'

BA =
25 13 74

(AB)'=

36 25 75

53 43 18

28 12 52

26

9 10

83 56 40

A' =
4

53 43 18

26

B' =

B'*A'=

9 10

83 56 40

3.

B=[3800;1200;2350]

[V,D]=eig(A)

B = 3800

V (Eigen vectors) =

1200

0.5000 -0.7071 -0.5000

2350

0.7071 -0.0000 0.7071

x=transpose(B)/A

0.5000 0.7071 -0.5000

x = 361.3990 143.4370 297.6684

D (Eigen values) =

B=x*A
B =1.0e+003 *(3.8000 1.2000 2.3500)

11.7157

0 40.0000

0 68.2843

6.
[L1,U]=lu(A)
L1 =

4.

1.0000

A'=

0.6667 1.0000

0
0

-0.3333 -0.3636 1.0000


U=
3.0000 -2.0000 1.0000

cond(A)= 3.8131e+016 (condition number)

5.

7.3333 -4.6667
0

3.6364

A=[15 -3 -1;-3 18 -6;-4 -1 12]

7.

A=

F=@(v) 0.2741*v.^1.9842

15 -3 -1

v=linspace(0,90,10)

-3 18 -6

v = 0 10 20 30 40 50 60 70 80 90

-4 -1 12

F(v)
ans = 1.0e+003 *

9.

( 0 0.0264 0.1046 0.2338 0.4137


0.6442 0.9249 1.2559 1.6369 2.0678)

Density=@(T) 5.5280*10^-8*T.^3-8.5016*10^10*T.^2+6.5622*10^-5+0.99987

plot(v,F(v))

Convert degrees Fahrenheit (F) or Celsius (C)


Tf is in degrees Fahrenheit and T is in Celsius
T=@(Tf) (Tf-32)*(5/9)
Tf=linspace(32,82.4,3.6)
Tf =32.0000 57.2000 82.4000
T=T(Tf)
T = 0 14.0000 28.0000
Density(T) =0.9999 1.0001 1.0011

8.
t=linspace(0,6*pi,100);
X=sin(t).*exp(-0.1.*t);
Y=cos(t).*exp(-0.1.*t);
Z=t;
subplot(2,1,1),plot(X,Y);
subplot(2,1,2),plot3(X,Y,Z);

You might also like