Tarea 8 Mayo
Tarea 8 Mayo
>> A = [1 2 3 4 5 6 ; 7 8 9 10 11 12]
A=
1 2 3 4 5 6
7 8 9 10 11 12
>> B = [1 7 ; 2 8 ; 3 9 ; 4 10 ; 5 11 ; 6 12]
B=
1 7
2 8
3 9
4 10
5 11
6 12
>> output_precision(1)
>> C = [0.6 1.5 2.3 -0.5 ; 8.2 0.5 -0.1 -2.0 ; 5.7 8.2 9.0 1.5 ; 1.2 -2.3 -4.3 0.5]
C=
>> size(A)
ans =
2 6
>> size(B)
ans =
6 2
>> size(C)
ans =
4 4
>> a1 = A(2,3)
a1 = 9
>> a2 = A(3,2)
error: A(I,J): row index out of bounds; value 3 out of bound 2
>> b1 = B(2,3)
error: A(I,J): column index out of bounds; value 3 out of bound 2
>> b1 = B(3,2)
b1 = 9
>> c1 = C(2,3)
c1 = -0.1
>> c1 = C(3,2)
c1 = 8.2
>> a3 = A(:,2)
a3 =
2
8
>> c3 = C(4:5,1:3)
error: A(I,J): row index out of bounds; value 5 out of bound 4
>> c4 = C(1:2:5,:)
error: A(I,J): row index out of bounds; value 5 out of bound 4
>> c5 = C([5 2 1], 3:-1:2)
error: A(I,J): row index out of bounds; value 5 out of bound 4
>> D = [4:9; 1:6]
D=
4 5 6 7 8 9
1 2 3 4 5 6
>> E = [D A]
E=
4 5 6 7 8 9 1 2 3 4 5 6
1 2 3 4 5 6 7 8 9 10 11 12
1 1 7 4 5 6
7 2 8 10 11 12
1 7
2 8
3 9
4 4
5 5
6 6
>> I5 = eye(5)
I5 =
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
>> F = zeros(3,2)
F=
0 0
0 0
0 0
1 1000
O también
1 100
>> t = -2:0.1:2
>> x = 100 * t
>> y = -9.81*t.^2+20
>> for i = 1:length(t)
plot(-200,0)
hold on
plot(200,25)
plot(x(i),y(i),'o')
plot(x(1:i),y(1:i),'.')
pause(.05)
Image = getframe;
P = frame2im(Image);
number = num2str(i);
extension = '.bmp';
filename = [number,extension];
imwrite(P,eval('filename'), 'bmp');
hold off
End