You are on page 1of 2

Practica de comandos

1) x= [0 3 pi exp (2)]
y= (0:0.1:1)*pi
2) z= [1+i 1-i 2+i 4-i]
3) z (1,3)
4) y (1:5)
5) y (end, 7:11)
6) y (1:2:11)
7) y (1, [2 4 5 7])
8) a= [1:1:5]
b= [1:2:9]
9) c= [a b]
10) c
11) z.'
12) g= [1:1:4; 5:1:8]
h= [[ones (1,4)]; [2*ones (1,4)]]
13) g+h
14) no es realizable el producto ya que g es de 2x4 y h tambin de 2x4
15) g*h'
16) g.*h
17) 2. ^g
18) A= [2 3 1; 4 1 2; 6 1 7]
b= [6; 7; 4]
x=inv(A)*b
19) x=A\b
20) [(9.8-0.8)/(4-log(2))]^(245/124)
21) t1=diag (1:4)
t2= [1:4; 5:8; 9:12; 20 0 5 4]
t3=t2'
t4=zeros (4)
T= [t1 t2; t3 t4]
T1=T (3:6,3:6)
22) function A=matriz (m, n)

for i=1: m,
for j=1: n,
A (i, j) =10*(i-j) +1;
end
end;

matriz (10,10)
23) R= [eye (5)+ diag (-2*ones (4,1) ,1)+diag (-2*ones (4,1),-1)]
24) b= [1:1:5]'
x=R\b
26) A= [1 2 3; 4 5 6; 7 8 9]
a=A (3:-1:1, :)
b= a (:,2:-1:1)
c=A ([1 2], [1 3])
27) x1= [-1000:0.01:0]

f=inline ('x1. ^2')


y1=f(x1)
Plot(x1, y1,'r')
x2= [0:0.01:1]
f=inline ('1')
y2=f(x2)
Plot(x2, y2,'b')
x3= [1:0.01:1000]
f=inline ('-x3+2')
y3=f(x3)
Plot(x3, y3,'r')

10

x 10

-2
-1000

-800

-600

-400

-200

200

400

28) %y=exp (-x^3) para todo xe [0,2pi]


x= [0:0.01:2*pi]
f=inline (exp (-x. ^3)')
y=f(x);
Plot(x, y,'r')
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0

600

800

1000

You might also like