0% found this document useful (0 votes)
27 views8 pages

29/02/16 01:10 PM MATLAB Command Window 1 of 8

This document contains a log of MATLAB commands and outputs. It demonstrates how to define and manipulate vectors, calculate dimensions and properties of matrices, perform basic arithmetic and mathematical operations on matrices and vectors, and explore trigonometric, exponential, and hyperbolic functions in MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views8 pages

29/02/16 01:10 PM MATLAB Command Window 1 of 8

This document contains a log of MATLAB commands and outputs. It demonstrates how to define and manipulate vectors, calculate dimensions and properties of matrices, perform basic arithmetic and mathematical operations on matrices and vectors, and explore trigonometric, exponential, and hyperbolic functions in MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

29/02/16 01:10 PM

MATLAB Command Window

>> u=[1 2 3]
u =
1

>> v=[1,2,3] % vectores fila


v =
1

>> w=[1;2;3]
w =
1
2
3
>> z=[1 2 3]% vectores columna
z =
1

>> length(u)
ans =
3
>> length(w)
ans =
3
>> [f,c]= size(u)
f =
1
c =
3
>> dimension=size(w)

1 of 8

29/02/16 01:10 PM

MATLAB Command Window

dimension =
3

>> ans=
ans=
|
Error: Expression or statement is incomplete or incorrect.
>> ans=3
ans =
3
>> ans=3
ans =
3
>> f=1
f =
1
>> c=1
c =
1
>> dimension= 3 1
dimension= 3 1
|
Error: Unexpected MATLAB expression.
>> dimension=
dimension=
|
Error: Expression or statement is incomplete or incorrect.
>> u+v
ans =
2
>> u.*v

2 of 8

29/02/16 01:10 PM

MATLAB Command Window

3 of 8

ans =
1

>> u.*v % producto elemento a elemento


ans =
1

>> a=[1 2 3];


>> b=[4 5 6];
>> c= dot(a,b)
c =
32
>> d=cross(a,b)
d =
-3

-3

>> n=100;
>> a=1:n;
>> S=sum(a)
S =
5050
>> a=1:10;
>> cs=cumsum(a)
cs =
1

>> a=3:3:5000;
>> s=sum(a)
s =
4165833
>> A=[1,2;3,4]
A =
1

10

15

21

28

36

45

55

29/02/16 01:10 PM
3

MATLAB Command Window

>> B=[-1 -2 -3 -4]


B =
-1

-2

-3

-4

>> A(2 1)=0


A(2 1)=0
|
Error: Unexpected MATLAB expression.
>> A(2 1)
A(2 1)
|
Error: Unexpected MATLAB expression.
>> A(2,:)
ans =
3

>> A(:,1)
ans =
1
3
>> M=[A,B;B,A]
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
>> M41=M(1:3,2:4)
Undefined function 'M' for input arguments of type 'double'.
>> M=eye(4)
M =
1
0
0
0

0
1
0
0

>> N=zeros(3)
N =

0
0
1
0

0
0
0
1

4 of 8

29/02/16 01:10 PM
0
0
0

0
0
0

MATLAB Command Window

0
0
0

>> O=ones(2)
O =
1
1

1
1

>> P=rand(3,2)
P =
0.8147
0.9058
0.1270

0.9134
0.6324
0.0975

>> A+B
Error using +
Matrix dimensions must agree.
>> A(1,1)*B(1,1)+A(1,2)*B(2,1)
Index exceeds matrix dimensions.
>> A+B-B*A
Error using +
Matrix dimensions must agree.
>> sqrt(4)
ans =
2
>> sqrt(-4)
ans =
0.0000 + 2.0000i
>> abs(4)
ans =
4
>> abs(-4)
ans =

5 of 8

29/02/16 01:10 PM

MATLAB Command Window

6 of 8

4
>> abs(3+4*i)
ans =
5
>> exp(1)
ans =
2.7183
>> log(ans)
ans =
1
>> log10(10)
ans =
1
>> n=log(16384)/log(2)
n =
14
>> format long
>> e=4:14;
>> v=2.^e
v =
Columns 1 through 10
2048

16

Column 11
16384
>> S=sum(v)
S =

4096

32

8192

64

128

256

512

1024

29/02/16 01:10 PM

MATLAB Command Window

32752
>> v=
v=
|
Error: Expression or statement is incomplete or incorrect.
>> v= columns 1 through 6
v= columns 1 through 6
|
Error: Unexpected MATLAB expression.
>> sin(pi/2)
ans =
1
>> sin(90)
ans =
0.893996663600558
>> atan(1)*180/pi
ans =
45
>> atan2(1,1)*180/pi
ans =
45
>> atan2(-1,-1)*180/pi
ans =
-135
>> sinh(1)
ans =
1.175201193643801
>> (exp(1)-exp(-1))/2

7 of 8

29/02/16 01:10 PM

MATLAB Command Window

ans =
1.175201193643802
>> cosh(1)
ans =
1.543080634815244
>> (exp(1)+exp(-1))/2
ans =
1.543080634815244
>> tanh(1)
ans =
0.761594155955765
>> sinh(1)/cosh(1)
ans =
0.761594155955765
>> x=-1:0.01:1;
>> y=tanh(x);
>> plot(x,y)
>> function y=runge(x)
function y=runge(x)
|
Error: Function definitions are not permitted in this
context.
>> function y= runge(x)
function y= runge(x)
|
Error: Function definitions are not permitted in this
context.
>> function y = runge(x)
function y = runge(x)
|
Error: Function definitions are not permitted in this
context.
>> % funtion runge
>>

8 of 8

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