Você está na página 1de 21

clc

clear all
a=5

a =

a =

b=10

b =

10

s=a+b

s =

15

R=a-b

R =

-5

D=a/b

D =

0.5000

M=a*b

M =

50

d=a^2

d =

25

M/2

ans =
25

c=5^2-6/2+5*4

c =

42

x=sqrt(2)

x =

1.4142

p=pi

p =

3.1416

nthroot(-8^,3)
nthroot(-8^,3)
|
{Error: Expression or statement is incorrect--possibly unbalanced (,
{, or [.
}
nthroot(-8,3)ans
nthroot(-8,3)ans
|
{Error: Unexpected MATLAB expression.
}
nthroot(-8,3)

ans =

-2

log10(100)

ans =

log(10)

ans =

2.3026

Z=rem(50,4)

Z =

2
whos
Name Size Bytes Class Attributes

D 1x1 8 double
M 1x1 8 double
R 1x1 8 double
Z 1x1 8 double
a 1x1 8 double
ans 1x1 8 double
b 1x1 8 double
c 1x1 8 double
d 1x1 8 double
p 1x1 8 double
s 1x1 8 double
x 1x1 8 double

who

Your variables are:

D M R Z a ans b c d p s x

whos z
z
{Undefined function or variable 'z'.
}
z
{Undefined function or variable 'z'.
}
Z

Z =

whos z
z
{Undefined function or variable 'z'.
}
Z

Z =

CLEAR Z
{Undefined function 'CLEAR' for input arguments of type 'char'.
}
clear Z
Z
{Undefined function or variable 'Z'.
}
clear all
whos
clc
dir

. CLASE 1 MBCEUPSMAT 2016 0.doc


..

help sqrt
<strong>sqrt</strong> Square root.
<strong>sqrt</strong>(X) is the square root of the elements of X.
Complex
results are produced if X is not positive.

See also <a href="matlab:help sqrtm">sqrtm</a>, <a


href="matlab:help realsqrt">realsqrt</a>, <a href="matlab:help
hypot">hypot</a>.

Overloaded methods:
<a href="matlab:help codistributed/sqrt">codistributed/sqrt</a>

Reference page in Help browser


<a href="matlab:doc sqrt">doc sqrt</a>

doc sqrt
pwd

ans =

C:\Users\matematica\Desktop\CLASE 1 MBCEUPSMAT 2016 0

path

CREANDO VECTORES
{Undefined function 'CREANDO' for input arguments of type 'char'.
}
V=[2 5 8 6 -10]

V =

2 5 8 6 -10

V=`2,5,8,6,-10]
V=`2,5,8,6,-10]
|
{Error: The input character is not valid in MATLAB statements or
expressions.
}
V=[2,5,8,6,-10]

V =

2 5 8 6 -10
V=[2;5;8;6:-10]

V =

2
5
8

V=[2;5;8;6;-10]

V =

2
5
8
6
-10

whos
Name Size Bytes Class Attributes

V 5x1 40 double
ans 1x19 38 char

a=1:4

a =

1 2 3 4

b:0:3:9
{Undefined function or variable 'b'.
}
b=o:3:9
{Undefined function or variable 'o'.
}
b=0:3:9

b =

0 3 6 9

z=(0:0.1:0.5)*pi

z =

0 0.3142 0.6283 0.9425 1.2566 1.5708

y=cos(z)

y =

1.0000 0.9511 0.8090 0.5878 0.3090 0.0000


plot(z,y)
y(1:4)

ans =

1.0000 0.9511 0.8090 0.5878

y(2)

ans =

0.9511

y([5 1 6])

ans =

0.3090 1.0000 0.0000

d=[a(1:2:4)5 8 9]
d=[a(1:2:4)5 8 9]
|
{Error: Unexpected MATLAB expression.
}
d=[a(1:2:4)589]
d=[a(1:2:4)589]
|
{Error: Unexpected MATLAB expression.
}
d=[a(1:2:4) 5 8 9]

d =

1 3 5 8 9

d-3

ans =

-2 0 2 5 6

a+b

ans =

1 5 9 13

length(a)

ans =

4
dot(a,b)

ans =

60

a*b
{Error using <a href="matlab:helpUtils.errorDocCallback('mtimes')"
style="font-weight:bold"> * </a>
Inner matrix dimensions must agree.
}
a

a =

1 2 3 4

b =

0 3 6 9

a.*b

ans =

0 6 18 36

a.^2

ans =

1 4 9 16

a./b

ans =

Inf 0.6667 0.5000 0.4444

b.^a

ans =

0 9 216 6561

b(3)=[]

b =

0 3 9

b
b =

0 3 9

b(5)012
b(5)012
|
{Error: Unexpected MATLAB expression.
}
b(5)=12

b =

0 3 9 0 12

b'

ans =

0
3
9
0
12

GRAFICAR1

X =

Empty matrix: 1-by-0

GRAFICAR1

X =

Empty matrix: 1-by-0

{Undefined function or variable 'x'.

Error in <a href="matlab:helpUtils.errorDocCallback('GRAFICAR1',


'C:\Users\matematica\Desktop\CLASE 1 MBCEUPSMAT 2016 0\GRAFICAR1.m',
3)" style="font-weight:bold">GRAFICAR1</a> (<a href="matlab:
opentoline('C:\Users\matematica\Desktop\CLASE 1 MBCEUPSMAT 2016
0\GRAFICAR1.m',3,0)">line 3</a>)
y1=x.^2
}
GRAFICAR1

X =

Empty matrix: 1-by-0

{Undefined function or variable 'x'.


Error in <a href="matlab:helpUtils.errorDocCallback('GRAFICAR1',
'C:\Users\matematica\Desktop\CLASE 1 MBCEUPSMAT 2016 0\GRAFICAR1.m',
3)" style="font-weight:bold">GRAFICAR1</a> (<a href="matlab:
opentoline('C:\Users\matematica\Desktop\CLASE 1 MBCEUPSMAT 2016
0\GRAFICAR1.m',3,0)">line 3</a>)
y1=x.^2
}
GRAFICAR1

X =

Empty matrix: 1-by-0

{Undefined function or variable 'x'.

Error in <a href="matlab:helpUtils.errorDocCallback('GRAFICAR1',


'C:\Users\matematica\Desktop\CLASE 1 MBCEUPSMAT 2016 0\GRAFICAR1.m',
3)" style="font-weight:bold">GRAFICAR1</a> (<a href="matlab:
opentoline('C:\Users\matematica\Desktop\CLASE 1 MBCEUPSMAT 2016
0\GRAFICAR1.m',3,0)">line 3</a>)
y1=x.^2
}
GRAFICAR1

X =

Empty matrix: 1-by-0

y1 =

Empty matrix: 1-by-0

GRAFICAR1

x =

Empty matrix: 1-by-0

y1 =

Empty matrix: 1-by-0

GRAFICAR1

x =

Empty matrix: 1-by-0

y1 =
Empty matrix: 1-by-0

GRAFICAR1

ans =

y1 =

y2 =

y =

-0.4000

GRAFICAR1

ans =

y1 =

y2 =

y =

-0.4000

GRAFICAR1

ans =

y1 =

1
y2 =

y =

-0.4000

GRAFICAR1
{Error: <a href="matlab: opentoline('C:\Users\matematica\Desktop\CLASE
1 MBCEUPSMAT 2016 0\GRAFICAR1.m',2,3)">File: GRAFICAR1.m Line: 2
Column: 3</a>
Expression or statement is incomplete or incorrect.
}
GRAFICAR1

ans =

y1 =

y2 =

y =

-0.4000

GRAFICAR1

ans =

y1 =

y2 =

1
y =

-0.4000

GRAFICAR1

ans =

y1 =

y2 =

y =

-0.4000

GRAFICAR1

y1 =

Columns 1 through 9

1.0000 1.2100 1.4400 1.6900 1.9600 2.2500 2.5600


2.8900 3.2400

Columns 10 through 18

3.6100 4.0000 4.4100 4.8400 5.2900 5.7600 6.2500


6.7600 7.2900

Columns 19 through 27

7.8400 8.4100 9.0000 9.6100 10.2400 10.8900 11.5600


12.2500 12.9600

Columns 28 through 31

13.6900 14.4400 15.2100 16.0000

y2 =

Columns 1 through 9
1.0000 1.1105 1.2446 1.4065 1.6017 1.8371 2.1213
2.4647 2.8807

Columns 10 through 18

3.3856 4.0000 4.7496 5.6667 6.7916 8.1754 9.8821


11.9931 14.6111

Columns 19 through 27

17.8666 21.9257 27.0000 33.3596 41.3504 51.4157 64.1251


80.2118 100.6211

Columns 28 through 31

126.5745 159.6532 201.9073 256.0000

y =

Columns 1 through 9

-0.4000 -0.3150 -0.2297 -0.1458 -0.0650 0.0118 0.0841


0.1520 0.2157

Columns 10 through 18

0.2759 0.3333 0.3891 0.4442 0.4999 0.5574 0.6182


0.6838 0.7559

Columns 19 through 27

0.8364 0.9277 1.0323 1.1533 1.2943 1.4599 1.6554


1.8872 2.1632

Columns 28 through 31

2.4933 2.8892 3.3658 3.9412

GRAFICAR1

y1 =

Columns 1 through 9

1.0000 1.2100 1.4400 1.6900 1.9600 2.2500 2.5600


2.8900 3.2400

Columns 10 through 18

3.6100 4.0000 4.4100 4.8400 5.2900 5.7600 6.2500


6.7600 7.2900

Columns 19 through 27
7.8400 8.4100 9.0000 9.6100 10.2400 10.8900 11.5600
12.2500 12.9600

Columns 28 through 31

13.6900 14.4400 15.2100 16.0000

y2 =

Columns 1 through 9

1.0000 1.1105 1.2446 1.4065 1.6017 1.8371 2.1213


2.4647 2.8807

Columns 10 through 18

3.3856 4.0000 4.7496 5.6667 6.7916 8.1754 9.8821


11.9931 14.6111

Columns 19 through 27

17.8666 21.9257 27.0000 33.3596 41.3504 51.4157 64.1251


80.2118 100.6211

Columns 28 through 31

126.5745 159.6532 201.9073 256.0000

y =

Columns 1 through 9

-0.4000 -0.3150 -0.2297 -0.1458 -0.0650 0.0118 0.0841


0.1520 0.2157

Columns 10 through 18

0.2759 0.3333 0.3891 0.4442 0.4999 0.5574 0.6182


0.6838 0.7559

Columns 19 through 27

0.8364 0.9277 1.0323 1.1533 1.2943 1.4599 1.6554


1.8872 2.1632

Columns 28 through 31

2.4933 2.8892 3.3658 3.9412

GRAFICAR1
y =

Columns 1 through 9

-0.4000 -0.3150 -0.2297 -0.1458 -0.0650 0.0118 0.0841


0.1520 0.2157

Columns 10 through 18

0.2759 0.3333 0.3891 0.4442 0.4999 0.5574 0.6182


0.6838 0.7559

Columns 19 through 27

0.8364 0.9277 1.0323 1.1533 1.2943 1.4599 1.6554


1.8872 2.1632

Columns 28 through 31

2.4933 2.8892 3.3658 3.9412

clc
M=[1 2 3 4;5 6 7 8]

M =

1 2 3 4
5 6 7 8

diary('clase 1 de matrices '.doc)


diary('clase 1 de matrices '.doc)
|
{Error: Unexpected MATLAB operator.
}
y('clase 1 de matrices '.doc)
y('clase 1 de matrices '.doc)
|
{Error: Unexpected MATLAB operator.
}
clc
M=[1 2 3 4;5 6 7 8]

M =

1 2 3 4
5 6 7 8

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

A =

3 5 8
5 1 9
7 4 9
A'

ans =

3 5 7
5 1 4
8 9 9

trace(A)

ans =

13

det(A)

ans =

113.0000

A(3,3)=0

A =

3 5 8
5 1 9
7 4 0

**
**
|
{Error: Unexpected MATLAB operator.
}
A

A =

3 5 8
5 1 9
7 4 0

A(:,1)

ans =

3
5
7

A(3,:)

ans =
7 4 0

B=A(3:-1:1,:)

B =

7 4 0
5 1 9
3 5 8
Warning: Image is too big to fit on screen; displaying at 50%}
{> In <a href="matlab: opentoline('C:\Program Files
(x86)\MATLAB\R2012a\toolbox\images\imuitools\private\initSize.m',72,1)
">imuitools\private\initSize at 72</a>
In <a href="matlab: opentoline('C:\Program Files
(x86)\MATLAB\R2012a\toolbox\images\imuitools\imshow.m',259,1)">imshow
at 259</a>
In <a href="matlab: opentoline('C:\Users\matematica\Desktop\CLASE 1
MBCEUPSMAT 2016 0\procesamientoimagen.m',13,1)">procesamientoimagen at
13</a>}
T=`[7 0 12]
T=`[7 0 12]
|
{Error: The input character is not valid in MATLAB statements or
expressions.
}
T=[7 0 12]

T =

7 0 12

A(2,:)=T
{Subscripted assignment dimension mismatch.
}
A(2,:)=T
{Subscripted assignment dimension mismatch.
}
A=[3 5 8;5 1 9;7 4 9]

A =

3 5 8
5 1 9
7 4 9

A(2,:)=T

A =

3 5 8
7 0 12
7 4 9

S:size(A)
{Undefined function or variable 'S'.
}
s=size(A)

s =

3 3

A(2,6)=1

A =

3 5 8 0 0 0
7 0 12 0 0 1
7 4 9 0 0 0

S=size(A)

S =

3 6

[f c]=size(A)

f =

c =

ones(3,2)

ans =

1 1
1 1
1 1

ones(3)

ans =

1 1 1
1 1 1
1 1 1

zeros(2)

ans =

0 0
0 0

zeros(2,3)

ans =

0 0 0
0 0 0

eye(3)

ans =

1 0 0
0 1 0
0 0 1

eye(5,4
eye(5,4
|
{Error: Expression or statement is incorrect--possibly unbalanced (,
{, or [.
}
eye(5,4)

ans =

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
0 0 0 0

A=[2 3 -4;1 -1 1;4 -7 14]

A =

2 3 -4
1 -1 1
4 -7 14

b=[3;-0.5;2]

b =

3.0000
-0.5000
2.0000

x=A/b
{Error using <a href="matlab:helpUtils.errorDocCallback('mrdivide')"
style="font-weight:bold"> / </a>
Matrix dimensions must agree.
}
clc
clear all
f=x^2-12
{Undefined function or variable 'x'.
}
syms x
f=x^2-12

f =

x^2 - 12

x=solve(f)

x =

2*3^(1/2)
-2*3^(1/2)

whos ans

whos ans
double ans

ans =

97 110 115

whos ans
Name Size Bytes Class Attributes

ans 1x3 24 double

double ans

ans =

97 110 115

whos x
Name Size Bytes Class Attributes

x 2x1 60 sym

double(ans)

ans =

97 110 115

doublex)
doublex)
|
{Error: Unbalanced or unexpected parenthesis or bracket.
}
double(x)

ans =

3.4641
-3.4641

t=ans(2)

t =

-3.4641

close all
diary off

Você também pode gostar