You are on page 1of 20

NRC:2780

{#Undefined function or variable 'NRC'.


}#
nombre: cinthya jimenez
nombre: cinthya jimenez
#
{#Error: Invalid expression. Check for missing multiplication operator, missing or
unbalanced delimiters, or other syntax
error. To construct matrices, use brackets instead of parentheses.
}#
CinthyaJimenez
{#Undefined function or variable 'CinthyaJimenez'.
}#
date

ans =

'19-Sep-2019'
a=8;
b=7;
a+b

ans =

15

a-b

ans =

c=a/b

c =

1.1429

who

Your variables are:

a ans b c

whos
Name Size Bytes Class Attributes

a 1x1 8 double
ans 1x1 8 double
b 1x1 8 double
c 1x1 8 double

format long
pi

ans =

3.141592653589793
format short
pi

ans =

3.1416

format short e
pi

ans =

3.1416e+00

format long e
pi

ans =

3.141592653589793e+00

format long eng


pi

ans =

3.14159265358979e+000

format short eng


pi

ans =

3.1416e+000

format bank
pi

ans =

3.14

format rat
pi

ans =

355/113

format +
pi

ans =

-pi

ans =
-

ans =

format short
exp(0)

ans =

exp(1)

ans =

2.7183

inf

ans =

Inf

nan

ans =

NaN

realmin

ans =

2.2251e-308

realmax

ans =

1.7977e+308

ceil(pi)

ans =

floor(pi)

ans =

round(pi)
ans =

abs(-pi)

ans =

3.1416

sign(pi)

ans =

sign(-pi)

ans =

-1

sign(0)

ans =

gcd(9,12)

ans =

lcm(9,12)

ans =

36

log(10)

ans =

2.3026

log10(10)

ans =

log2(10)

ans =

3.3219
mod(-12,5)

ans =

ren(12,5)
{#Undefined function or variable 'ren'.
}#
rem(12,5)

ans =

sqrt(50)

ans =

7.0711

nthroot(50,3)

ans =

3.6840

nthroot(50,4)

ans =

2.6591

x=5+7i

x =

5.0000 + 7.0000i

y=3-7j

y =

3.0000 - 7.0000i

abs(x)

ans =

8.6023

angle(x)

ans =

0.9505

complex(9,-2)
ans =

9.0000 - 2.0000i

conj(x)

ans =

5.0000 - 7.0000i

imag(x)

ans =

real(x)

ans =

sign(x)

ans =

0.5812 + 0.8137i

isreal(x)

ans =

<a href="matlab:helpPopup logical" style="font-weight:bold">logical</a>

isreal(a)

ans =

<a href="matlab:helpPopup logical" style="font-weight:bold">logical</a>

clc
x=[-7,4,3,2 -1 6 -7]

x =

-7 4 3 2 -1 6 -7

y=x+3

y =

-4 7 6 5 2 9 -4

x+y
ans =

-11 11 9 7 1 15 -11

x(2)

ans =

x =

-7 4 3 2 -1 6 -7

x(5)

ans =

-1

x(end)

ans =

-7

x(1:2:5)

ans =

-7 3 -1

x =

-7 4 3 2 -1 6 -7

x=([3 5 1])

x =

3 5 1

x([3 5 1])
{#Index exceeds array bounds.
}#
x([3 5 1])
{#Index exceeds array bounds.
}#
x

x =

3 5 1

x=[-7,4,3,2 -1 6 -7]
x =

-7 4 3 2 -1 6 -7

x([3 5 1])

ans =

3 -1 -7

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

A =

1 2 3
4 5 6
7 8 9

A(2,1)

ans =

A(5)

ans =

A =

1 2 3
4 5 6
7 8 9

A(2,:)

ans =

4 5 6

A(:,2)

ans =

2
5
8

A(2,2:3)

ans =

5 6
A=([2 1],2:3)
A=([2 1],2:3)
#
{#Error: Invalid expression. When calling a function or indexing a variable, use
parentheses. Otherwise, check for
mismatched delimiters.
}#
A=([2 1],2:3)
A=([2 1],2:3)
#
{#Error: Invalid expression. When calling a function or indexing a variable, use
parentheses. Otherwise, check for
mismatched delimiters.
}#
A([2 1],2:3)

ans =

5 6
2 3

A(2,[3 1])

ans =

6 4

A(end,3)

ans =

(1:7)

ans =

1 2 3 4 5 6 7

(1:3:12)

ans =

1 4 7 10

(60:-6:1)

ans =

60 54 48 42 36 30 24 18 12 6

clc
zeros(5)

ans =

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

zeros(5,3)

ans =

0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

ones(5,3)

ans =

1 1 1
1 1 1
1 1 1
1 1 1
1 1 1

ones(5)

ans =

1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

ones(5,4)

ans =

1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1

rand(5)

ans =

0.8147 0.0975 0.1576 0.1419 0.6557


0.9058 0.2785 0.9706 0.4218 0.0357
0.1270 0.5469 0.9572 0.9157 0.8491
0.9134 0.9575 0.4854 0.7922 0.9340
0.6324 0.9649 0.8003 0.9595 0.6787

rand(5)

ans =

0.7577 0.7060 0.8235 0.4387 0.4898


0.7431 0.0318 0.6948 0.3816 0.4456
0.3922 0.2769 0.3171 0.7655 0.6463
0.6555 0.0462 0.9502 0.7952 0.7094
0.1712 0.0971 0.0344 0.1869 0.7547

rand(5,3)

ans =

0.2760 0.4984 0.7513


0.6797 0.9597 0.2551
0.6551 0.3404 0.5060
0.1626 0.5853 0.6991
0.1190 0.2238 0.8909

randn(5)

ans =

1.5442 2.3505 -0.7648 -0.1961 -0.8045


0.0859 -0.6156 -1.4023 1.4193 0.6966
-1.4916 0.7481 -1.4224 0.2916 0.8351
-0.7423 -0.1924 0.4882 0.1978 -0.2437
-1.0616 0.8886 -0.1774 1.5877 0.2157

randn(5,3)

ans =

-1.1658 -0.6669 -1.7947


-1.1480 0.1873 0.8404
0.1049 -0.0825 -0.8880
0.7223 -1.9330 0.1001
2.5855 -0.4390 -0.5445

randn(5,4)

ans =

0.3035 -0.1941 0.9610 -1.2078


-0.6003 -2.1384 0.1240 2.9080
0.4900 -0.8396 1.4367 0.8252
0.7394 1.3546 -1.9609 1.3790
1.7119 -1.0722 -0.1977 -1.0582

eye(5)

ans =

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

eye(5,4)

ans =

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

hilb(5)

ans =

1.0000 0.5000 0.3333 0.2500 0.2000


0.5000 0.3333 0.2500 0.2000 0.1667
0.3333 0.2500 0.2000 0.1667 0.1429
0.2500 0.2000 0.1667 0.1429 0.1250
0.2000 0.1667 0.1429 0.1250 0.1111

hilb(5)

ans =

1.0000 0.5000 0.3333 0.2500 0.2000


0.5000 0.3333 0.2500 0.2000 0.1667
0.3333 0.2500 0.2000 0.1667 0.1429
0.2500 0.2000 0.1667 0.1429 0.1250
0.2000 0.1667 0.1429 0.1250 0.1111

invhilp(5)
{#Undefined function or variable 'invhilp'.
}#
invhilb(5)

ans =

25 -300 1050 -1400 630


-300 4800 -18900 26880 -12600
1050 -18900 79380 -117600 56700
-1400 26880 -117600 179200 -88200
630 -12600 56700 -88200 44100

A =

1 2 3
4 5 6
7 8 9

B=A.^3

B =

1 8 27
64 125 216
343 512 729

C=A+B

C =

2 10 30
68 130 222
350 520 738

A-B

ans =

0 -6 -24
-60 -120 -210
-336 -504 -720

A*B

ans =

1158 1794 2646


2382 3729 5562
3606 5664 8478
x=[4 5 6]

x =

4 5 6

y=[6 7 8]

y =

6 7 8

dot(x,y)

ans =

107

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

A =

1 2 3
4 5 6
7 8 9

det(A)

ans =

-9.5162e-16

diag(x)

ans =

4 0 0
0 5 0
0 0 6

eye(5)
ans =

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

hilb(5)

ans =

1.0000 0.5000 0.3333 0.2500 0.2000


0.5000 0.3333 0.2500 0.2000 0.1667
0.3333 0.2500 0.2000 0.1667 0.1429
0.2500 0.2000 0.1667 0.1429 0.1250
0.2000 0.1667 0.1429 0.1250 0.1111

A^2

ans =

30 36 42
66 81 96
102 126 150

diag(A)

ans =

1
5
9

eig(A)

ans =

16.1168
-1.1168
-0.0000

inv(A)
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate.
RCOND = 2.202823e-18.

ans =

1.0e+16 *

0.3153 -0.6305 0.3153


-0.6305 1.2610 -0.6305
0.3153 -0.6305 0.3153

lenght(A)
Undefined function or variable 'lenght'.

Did you mean:


length(A)

ans =

size(A)

ans =

3 3

null(A)

ans =

-0.4082
0.8165
-0.4082

orth(A)

ans =

-0.2148 0.8872
-0.5206 0.2496
-0.8263 -0.3879

pinv(A)

ans =

-0.6389 -0.1667 0.3056


-0.0556 0.0000 0.0556
0.5278 0.1667 -0.1944

poly(A)

ans =

1.0000 -15.0000 -18.0000 -0.0000

rank(A)

ans =

trace(A)

ans =

15

tril(A)

ans =

1 0 0
4 5 0
7 8 9

triu(A)

ans =

1 2 3
0 5 6
0 0 9

norm(A,3)
Error using norm
The only matrix norms available are 1, 2, inf, and 'fro'.

norm(A,1)

ans =

18

norm(A,2)

ans =

16.8481
help norm
norm - Vector and matrix norms

This MATLAB function returns the Euclidean norm of vector v.

n = norm(v)
n = norm(v,p)
n = norm(X)
n = norm(X,p)
n = norm(X,'fro')

See also cond, condest, hypot, normest, rcond, vecnorm

Reference page for norm


Other functions named norm
A
{#Undefined function or variable 'A'.
}#
x=[4 5 6]

x =

4 5 6

y=[6 7 8]

y =

6 7 8

dot(x,y)

ans =
107

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

A =

1 2 3
4 5 6
7 8 9

det(A)

ans =

-9.5162e-16

diag(x)

ans =

4 0 0
0 5 0
0 0 6

eye(5)

ans =

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

hilb(5)

ans =

1.0000 0.5000 0.3333 0.2500 0.2000


0.5000 0.3333 0.2500 0.2000 0.1667
0.3333 0.2500 0.2000 0.1667 0.1429
0.2500 0.2000 0.1667 0.1429 0.1250
0.2000 0.1667 0.1429 0.1250 0.1111

A^2

ans =

30 36 42
66 81 96
102 126 150

diag(A)

ans =

1
5
9

eig(A)

ans =

16.1168
-1.1168
-0.0000

inv(A)
[#Warning: Matrix is close to singular or badly scaled. Results may be inaccurate.
RCOND = 2.202823e-18.]#

ans =

1.0e+16 *

0.3153 -0.6305 0.3153


-0.6305 1.2610 -0.6305
0.3153 -0.6305 0.3153

lenght(A)
{#Undefined function or variable 'lenght'.
}#
length(A)

ans =

size(A)

ans =

3 3

null(A)

ans =

-0.4082
0.8165
-0.4082

orth(A)

ans =

-0.2148 0.8872
-0.5206 0.2496
-0.8263 -0.3879

pinv(A)

ans =

-0.6389 -0.1667 0.3056


-0.0556 0.0000 0.0556
0.5278 0.1667 -0.1944

poly(A)

ans =

1.0000 -15.0000 -18.0000 -0.0000

rank(A)

ans =

trace(A)

ans =

15

tril(A)

ans =

1 0 0
4 5 0
7 8 9

triu(A)

ans =

1 2 3
0 5 6
0 0 9

norm(A,3)
{#Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('norm')"
style="font-weight:bold">norm</a>
The only matrix norms available are 1, 2, inf, and 'fro'.
}#
norm(A,1)

ans =

18

norm(A,2)

ans =

16.8481

norm(A,'fro')

ans =

16.8819
help norm
norm - Vector and matrix norms

This MATLAB function returns the Euclidean norm of vector v.

n = norm(v)
n = norm(v,p)
n = norm(X)
n = norm(X,p)
n = norm(X,'fro')

See also <a


href="https://www.mathworks.com/help/releases/R2018a/matlab/ref/cond.html">cond</a>
, <a
href="https://www.mathworks.com/help/releases/R2018a/matlab/ref/condest.html">conde
st</a>, <a
href="https://www.mathworks.com/help/releases/R2018a/matlab/ref/hypot.html">hypot</
a>, <a
href="https://www.mathworks.com/help/releases/R2018a/matlab/ref/normest.html">norme
st</a>, <a
href="https://www.mathworks.com/help/releases/R2018a/matlab/ref/rcond.html">rcond</
a>, <a
href="https://www.mathworks.com/help/releases/R2018a/matlab/ref/vecnorm.html">vecno
rm</a>

<a href="matlab:doc norm">Reference page for norm</a>


<a
href="matlab:matlab.internal.language.introspective.overloads.displayOverloads('nor
m')">Other functions named norm</a>

normest(A)

ans =

16.8481

You might also like