You are on page 1of 5

APELLIDOS Y NOMBRES: CAMAYO OR, Aracelly Yelitza

EJERCICIOS SOBRE GRAFICAS BIDIMENCIONALES


% EJERCICIO 5.1 GRAFICA DE LAS LETRAS (a)y(b)
clc,clear
x=0:10;
a=exp(x);
b=sind(x);
subplot(1,2,1),plot(x,a,'r o'),title('GRAFICA
EXPONENCIAL'),xlabel('valores de X'),ylabel('valores de Y'),axis
equal,grid
subplot(1,2,2),plot(x,b,'g *'),title('GRAFICA SENO'),xlabel('valores
de X'),ylabel('valores de Y'),gtext('punto medio')
% EJERCICIO 5.1 GRAFICA DE LAS LETRAS (b) Y (c)
clc,clf,clear
figure(1)
x=1:10;
a=5;
b=2;
c=4,
y=a*x.^2+b.*x+c
plot(x,y,'m :'),title('GRAFICA DE LA LETRA
C'),xlabel('X'),ylabel('Y'),gtext('punto maximo'),grid
figure(2)
x=1:10;
y=sqrt(x);
plot(x,y,'y o'),title('GRAFICA DE LA LETRA
D'),xlabel('X'),ylabel('Y'),gtext('punto minimo')
% EFERCICIO 5.2
clc,clear,clf
x=[12,14,12,22,8,9];
y=[12,14,12,22,8,9];
plot(x,y,'r :'),title('GRAFICA DEL EJERCICIO NUMERO
5.2'),xlabel('X'),ylabel('Y'),grid
%GRAFICA DEL EJERCICIO NUMERO 5.3
clc,clf,clear
x=-pi:pi;
y=sin(x);
plot(x,y),title('GRAFICA 1'),xlabel('X'),ylabel('Y'),grid
holdon
x=-pi:pi;
y=sin(2*x);
plot(x,y),title('GRAFICA 1'),xlabel('X'),ylabel('Y'),grid
holdon
x=-pi:pi;
y=sin(3*x)
plot(x,y),title('GRAFICA 1'),xlabel('X'),ylabel('Y'),grid

%GRAFICA DEL EJERCICIO NUMERO 5.4


clc,clf,clear
x=-pi:pi;
y=sin(x);
plot(x,y,'r --'),title('GRAFICA 1'),xlabel('X'),ylabel('Y'),grid
holdon
x=-pi:pi;
y=sin(2*x);
plot(x,y,'b -'),title('GRAFICA 1'),xlabel('X'),ylabel('Y'),grid
holdon
x=-pi:pi;
y=sin(3*x)
plot(x,y,'g :'),title('GRAFICA 1'),xlabel('X'),ylabel('Y'),grid
%GRAFICA DEL EJERCICIO NUMERO 5.5
clc,clf,clear
x=-pi:pi;
y=sin(x);
plot(x,y,'r --'),title('GRAFICA 1'),xlabel('X'),ylabel('Y'),grid
holdon
x=-pi:pi;
y=sin(2*x);
plot(x,y,'b -'),title('GRAFICA 1'),xlabel('X'),ylabel('Y'),grid
holdon
x=-pi:pi;
y=sin(3*x)
plot(x,y,'g :'),title('GRAFICA
1'),xlabel('X'),ylabel('Y'),gtext('punto de interseccion'),grid
L=legend('x=valores de -4:4','y=sin(x)',4)
% EJERCICIO 5.6
clc,clear,clf
figure(1)
t=0:20;
Ht=t*100*cosd(45);
plot(Ht,t,'r *'),title('(a) GRAFICA DE DISTANCIA HORIZONTAL CONTRA EL
TIEMPO'),xlabel('distancia horizontal'),ylabel('tiempo')
figure(2)
t=0:20;
Vt=t*100*sind(45)-(1/2)*9.8*t.^2;
plot(t,Vt,'b d'),title('(b) GRAFICA DE DISTANCIA VERTICAL CONTRA EL
TIEMPO'),xlabel('tiempo'),ylabel('distancia vertical'),grid
%EJERCICIO 5.7
clc,clf,clear
t=0:20;
Ht=t*100*cosd(45);
Vt=t*100*sind(45)-(1/2)*9.8*t.^2;
plot(Ht,Vt,'r *'),title('GRAFICA DE DISTANCIA HORIZONTAL-DISTANCIA
VERTICAL'),xlabel('DISTANCIA HORIZONTAL'),ylabel('DISTANCIA
VERTICAL'),grid

EJERCICIOS SOBRE VECTORES


%EJERCICIO 1
clc;clearall
x=input('Ingrese un vector que tenga 50 valores:');
p=mean(x);
disp('EL PROMEDIO ES:');
disp(p)
disp('CUANTOS SON MAYORES QUE EL PROMEDIO?');
a=x>p;
vmp=sum(a);
disp(vmp)
disp('VALORES MAYORES QUE EL PROMEDIO');
dmp=x(a);
disp([dmp])
% EJERCICIO 2
clc;clearall
% VECTOR A
A=3:47
% VECTOR B
B=5:49
% VECTOR RESULTANTE
C=A+B
% EJERCICIO 3
clc,clear
x=input('Ingrese el vector x: ');
[m,p]=max(x);
disp('MAYOR ELEMENTO');
disp(m)
disp('POSICION DEL MAYOR ELEMENTO')
disp(p)
% EJERCICIO 5
clc;clearall
disp('ESTE ES EL VECTOR:');
x=[0 34 -12 45 -2 -5 0 98 13 -2 56 3 23 76 0 23 0 10 -23 -65];
disp(x)
disp('Cuantos son negativos?');
negativos=sum(x<0);
disp(negativos)
disp('Cuantos son positivos?');
positivos=sum(x>0);
disp(positivos)
disp('Cuantos son cero?');
cero=sum(x==0);
disp(cero)
% EJERCICIO 6
clc,clear
A=input('Ingrese el primer vector de cien elementos: ');
B=input('Ingrese el segundo vector de cien elementos: ');
if A==B
disp('ESTOS VECTORES SON IGUALES');
else
disp('ESTOS VECTORES SON DIFERENTES');
end

EJERCICIOS SOBRE MATRICES

% EJERCICIO 1: Defina una matriz de 15 x 15 y luego escriba las


ordenes
% para obtener la suma de los elementos de cada filas, de los
elementos de
% cada columna y la suma del total de todo los elementos de la matriz.
% Matriz de rango 15 que varia de 5 a 10 con dos decimales.
clc,clear
formatbank
X=5+rand(15)*5;
T=X';
SumaFilas=sum(T)
SumaColumnas=sum(X)
SumaTotal=sum(SumaFilas)
% EJERCICIO 2
clc,clear
x=ones(3)+eye(3)

% EJERCICIO 3: Dada la siguiente matriz A, escribir la orden usando


funciones conocidas
%para el tratamiento de matrices y transformar dicha matriz en la
matriz
%inferior. As mismo; la parte resaltada con rojo y lila debe
transferirse
%a una matriz CC:
clc,clear
formatshort
A=magic(8)
A([3:6],[3,4,5,6])=0;
A([4,5],[4,5])=1
CC=A([3:6],[3:6])
%EJERCICIO 4: Dada la siguiente matriz A, escribir la orden usando
funciones conocidas para el tratamiento de matrices para EXTRAER los
elementos con color a arreglos AA y BB:
clc,clear
A=magic(12)
AA=A(4,[2,4,6,8,10,12])
BB=A([2,4,6,8,10,12],5)
% EJERCICIO 5
clc,clear
a=magic(6)
aa=a(2:6,1:5);
aaa=tril(aa);
AA=triu(aaa)
bb=a(1:5,2:6);
bbb=tril(bb);
BB=triu(bbb)
% EJERCICIO 6
clc,clear
A=magic(5)
B=A([5,4,3,2,1],[5,4,3,2,1])

2.5

4
GRAFICA
EXPONENCIAL
x 10

GRAFICA SENO

0.18
0.16

0.14

1.5

valores de Y

valores de Y

0.12

0.1
0.08
0.06
0.04

0.5

0.02
0

2.5

5
valores de X

10

4
GRAFICA
EXPONENCIAL
x 10

5
valores de X

10

GRAFICA SENO

0.18
0.16

0.14

1.5

valores de Y

valores de Y

0.12

0.1
0.08
0.06
0.04

0.5

0.02
0

5
valores de X

10

5
valores de X

10

You might also like