0% found this document useful (0 votes)
36 views7 pages

Lab Control 1

This document introduces basic MATLAB commands like defining vectors and matrices, performing element-wise operations, taking the transpose, inverse, determinant, and eigenvalue of matrices. It also covers polynomial operations. The key concepts covered are basic MATLAB syntax, matrix/vector operations, and working with polynomials.

Uploaded by

Orlando Chavez
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 DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views7 pages

Lab Control 1

This document introduces basic MATLAB commands like defining vectors and matrices, performing element-wise operations, taking the transpose, inverse, determinant, and eigenvalue of matrices. It also covers polynomial operations. The key concepts covered are basic MATLAB syntax, matrix/vector operations, and working with polynomials.

Uploaded by

Orlando Chavez
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 DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

INTRODUCCION AL MATLAB

1. Repetir y ejercitar los siguientes comandos en Matlab.


>> a=1
b=[1 2]
a=
1
b=
1

>> a=2+i
b=-5-3*i
a=
2.0000 + 1.0000i
b=
-5.0000 - 3.0000i
>> a==1
ans =
0
>>v=[1 2 3 4 5]
v=
1

>> v=1:5
v=
1

>> A=[2 2 3
007
5 9 -1]
A=
2
0
5

2
0
9

3
7
-1

>> A=[2 2 3;0 0 7;5 9 -1]


A=
2
0
5

2
0
9

3
7
-1

>> a=1;b=2;
>> A=[a+b pi 3
b^2 0 atan(a)
5 sin(b) -1]
A=
3.0000
4.0000
5.0000

3.1416 3.0000
0
0.7854
0.9093 -1.0000

>>
B=zeros()
B=
0
>> B=zeros(2,3)
B=
0
0

0
0

0
0

>> A=[2 2 3;0 0 7;5 9 -1]; B=zeros(A)


B=
0
0
0

0
0
0

0
0
0

>> C=ones(2,3)
C=
1
1

1
1

1
1

>> D=diag(1:5)
D=
1
0
0
0
0

0
2
0
0
0

0
0
3
0
0

0
0
0
4
0

>> A=[1 2 3
456
7 8 9]
B=diag(A)
A=
1
4
7

2
5
8

3
6
9

B=
1
5
9
>> C=diag(diag(A))
C=
1
0
0

0
5
0

0
0
9

0
0
0
0
5

>> A=diag(ones(1,3))
A=
1
0
0

0
1
0

0
0
1

>> A=eye(3)
A=
1
0
0

0
1
0

0
0
1

>> B=A+A
B=
2
0
0

0
2
0

0
0
2

>> C=B+1
C=
3
1
1

1
3
1

1
1
3

>> A=[1 2 3;4 5 6;7 8 9]


C=[1 2 0;0 0 1;0 2 3]
D=A*C
A=
1
4
7

2
5
8

3
6
9

2
0
2

0
1
3

C=
1
0
0

D=
1
4
7

8 11
20 23
32 35

>> A=[1 0 0;0 2 3;5 0 4]


B=[2 0 0;0 2 2;0 0 3]
C=A.*B
A=
1
0
5

0
2
0

0
3
4

0
2
0

0
2
3

0
4
0

0
6
12

B=
2
0
0
C=
2
0
0

>> a=C(2,:)
a=
0

>> b=C(:,3)
b=
0
6
12
>> A=[1 2 3;4 5 6;7 8 9]; t=trace(A)
t=
15
>> r=rank(A)

r=
2
>> B=a
??? B=a
|
Error: The input character is not valid in MATLAB
statements or expressions.
>> B=A'
B=
1
2
3

4
5
6

7
8
9

>> A=[0 1;-2 -3];B=inv(A);A*B


ans =
1
0

0
1

>> d=det(A)
d=
2
>> v=[0 -1];p1=poly(v)
p1 =
1

>> p2=poly([1 2 1])


p2 =
1

-4

>> p=roots(p1)
p=

-2

0
-1
>> A=[0 1;-2 -3]
A=
0
-2

1
-3

>> r=eig(A)
r=
-1
-2
>> [V,D]=eig(A)
V=
0.7071 -0.4472
-0.7071 0.8944
D=
-1 0
0 -2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy