Está en la página 1de 20

FACULTAD DE INGENIERIA ELECTRICA Y

ELECTRONICA
UNIDAD DE POSGRADO

MAESTRA EN CIENCIAS: INGENIERA


ELCTRICA
MENCIN: SISTEMAS ELCTRICOS DE
DISTRIBUCIN

ASIGNATURA:

MTODOS COMPUTACIONALES
APLICADOS A LOS SISTEMAS
ELCTRICOS
CATEDRATICO:

TEMA

M.SC. RAL VILCAHUAMN


SANABRIA

PRIMERA PRACTICA DE MATLAB


ALUMNO:

CASAS ARIAS FELIX NILO


Ciclo Academico: I

Codigo del Alumno: 0000831135K

EJERCICIO 1
una piedra lanzada verticalmente haca arriba con una
velocidad de v1 de 60m/s, su desplazamiento esta dada por la

ecuacin d=v1*t-(1/2)*g*t. g es la aceleracin de la gravedad.


Se desprecia la resistencia del aire
se desea calcular el valor de d para 12.3 seg. en intervalos de
0.1 debe graficar distancia vs tiempo de periodo.
Programa MATLAB
% MOVIMIENTO VERTICAL BAJO GRAVEDAD
g=9.8
% aceleracin de la gravedad
v1=60;
% velocidad inicial en m/s
t=0:0.01:12.3;
% tiempo en segundos de 0 a 12.3
d=v1*t-(1/2)*g*t.^2 %desplazamiento vertical
plot(t,d),title('MOVIMIENTO VERTICAL BAJO GRAVEDAD')
xlabel('tiempo'),
ylabel('Desplazamiento vertical'),grid

MOVIMIENTO VERTICAL BAJO GRAVEDAD

200

Desplazamiento vertical

150

100

50

-50

tiempo

EJERCICIO 2
Programa MATLAB
disp ('movimiento de una pelota de golf')
disp ('---------------------------------')
disp(' ')
g=9.81;
vo=input('cual es la velocidad de lanzamiento en m/s? ')
tho=input('cual es el angulo de lanzamiento en grados ')
tho=pi*tho/180

10

12

14

%calculo del rango y duracion del vuelo


txmax=(2*vo/g)*sin(tho);
xmax=txmax*vo*cos(tho);
%calculo de la secuencia de tiempo por pasos para calcular la
%trayectoria
dt=txmax/100;
t=0:dt:txmax;
%calculo de la trayectoria
x=(vo*cos(tho)).*t;
y=(vo*sin(tho)).*t-(g/2).*t.^2;
%vx=dx/dt, vy=dy/dt.
vx=vo*cos(tho)
vy=vo*sin(tho)-g.*t;
v=sqrt(vx.*vx+vy.*vy);
th=(180/pi).*atan2(vy,vx);
%calculo del tiempo, distancia horizontal a la maxima altitud
tymax=(vo/g)*sin(tho);
xymax=xmax/2;
ymax=(vo/2)*tymax*sin(tho);
%mostrar resultados
disp(['rango en m= ',num2str(xmax),'Duracin en s=
',num2str(txmax)])
disp(' ')
disp(['maxima altitud en m= ',num2str(ymax),'Arribo en s=
',num2str(tymax)])
plot(x,y,'k',xmax,y(size(t)),'o',xmax/2,ymax,'o')
title(['TRAYECTORIA DE VUELO DEL PROYECTIL vo =
',num2str(vo),' \theta= ',num2str(180*tho/pi)])
xlabel('x'),ylabel('y') % figura 1
figure %crea una nueva
plot(v,th,'r')
title('VELOCIDAD DEL PROYECTIL VS ANGULO')
xlabel('V'),ylabel('\theta') %figura 2
%
% stop

Resultados
movimiento de una pelota de golf
--------------------------------cual es la velocidad de lanzamiento en m/s? 10
vo =
10
cual es el angulo de lanzamiento en grados 45
tho =
45

tho =
0.7854
vx =
7.0711
rango en m= 10.1937Duracin en s= 1.4416
maxima altitud en m= 2.5484Arribo en s= 0.7208
TRAYECTORIA DE VUELO DEL PROYECTIL vo = 10 = 45

2.5

1.5

0.5

6
x

10

12

VELOCIDAD DEL PROYECTIL VS ANGULO

50
40
30
20

10
0
-10
-20
-30
-40
-50

7.5

8.5
V

EJERCICIO 3
Programa MATLAB
clc
clear
disp('multiples graficos')
disp('-------------------')
[x,y]=meshgrid(-3:0.3:3);
z=x.*exp(-x.^2-y.^2);
subplot(2,2,1)
mesh(z),title('subplot(2,2,1)')

9.5

10

subplot(2,2,2)
mesh(z)
view(-37.5,70),title('subplot(2,2,2)')
subplot(2,2,3)
mesh(z)
view(37.5,-10),title('subplot(2,2,3)')
subplot(2,2,4)
mesh(z)
view(0,0),title('subplot(2,2,4)')
subplot(2,2,1)

subplot(2,2,2)

0.5
0.5
0
-0.5
30

0
-0.5
40

20

0 0

20

40

20

10
0 0

subplot(2,2,3)

subplot(2,2,4)

0.5

0.5

-0.5
0

40

20

20

40 0

EJERCICIO 4
Programa MATLAB
[x,y]=meshgrid(-2:.2:2);
z=x.*exp(-x.^2-y.^2);
meshc(z)

20

40

-0.5

10

20

30

0.5

-0.5
30
20
10
0

10

EJERCICIO 5
Programa MATLAB
clc
clear
disp('===================================== ')
disp('
GRFICOS INTERESANTES
')
disp('
')
disp('
Felix Nilo Casas Arias
')
disp('
Menu_graf.m ')
disp('===================================== ')
k = 0;
while k ~= 21
k = menu( 'elige un grafico', 'grafico con 4 vistas','recta con
pendiente ','rosa 4 petalos','lineas en 2d','grafico de un
matriz','medias parabolas','grafico de barras','lineas
concentricas','lineas verticales','hiperbolas concentricas','lineas
oblicuas','circulo','grafica seno','barras delgadas','ondas
3d','circulo de distribuciones','barras en 3d','cintas en
movimiento','parabola en cuadros','escalera circular','ondas en
3d','salir');
if k==1
m=0;
while m~=5

15

20

25

m=menu('elige un grafico','vista 1','vista 2','vista 3','vista


4','salir');
if m==1
[x, y] = meshgrid(-3:0.3:3);
z = x .* exp(-x.^2 - y.^2);
mesh(z),title('plot(2,2,1)')
elseif m==2
[x, y] = meshgrid(-3:0.3:3);
z = x .* exp(-x.^2 - y.^2);
mesh(z)
view(-37.5,70),title('plot(2,2,2)')
elseif m==3
[x, y] = meshgrid(-3:0.3:3);
z = x .* exp(-x.^2 - y.^2);
mesh(z)
view(37.5,-10),title('plot(2,2,3)')
elseif m==4
[x, y] = meshgrid(-3:0.3:3);
z = x .* exp(-x.^2 - y.^2);
mesh(z)
view(0,0),title('plot(2,2,4)')
end
end
elseif k == 2
x = 0:.01:4;
semilogy(x, exp(x)), grid
elseif k == 3
x = 0:pi/40:2*pi;
polar(x, sin(2*x)),grid
elseif k == 4
[x y ] = meshgrid(-8 : 0.5 : 8);
r = sqrt(x.^2 + y.^2) + eps;
z = sin(r) ./ r;
plot(z)
elseif k == 5
a = zeros(30,30);
a(:,15) = 0.2*ones(30,1);
a(7,:) = 0.1*ones(1,30);
a(15,15) = 1;
mesh(a)
elseif k == 6
x = 0:0.1:1.5;
area(x', [x.^2' ...
exp(x)' exp(x.^2)'])
elseif k == 7
x = 0:pi/20:pi;
bar(x,sin(x))
elseif k == 8
z = eig(randn(10));
compass(z)
elseif k == 9
x = 0:0.1:1;
errorbar(x,exp(-x), 0.5*rand(1,length(x)),'d')
elseif k == 10
ezcontourf('x^2-y^2')

elseif k == 11
th = 0:pi/16:pi;
z = exp((-0.5+2*i)*th);
feather(z)
elseif k == 12
t = 0:pi/20:2*pi;
fill(cos(t),sin(t),'k', 0.9*cos(t),0.9*sin(t),'y'),
axis square
clear
elseif k == 13
t = 0:pi/20:4*pi;
fill(t,sin(t),'b')
elseif k == 14
x = -20:120;
y = 50+20*randn(1,100000);
hist(y,x)
elseif k == 15
[x y] = meshgrid(-3:0.1:3);
z = peaks(x,y);
meshz(z)
elseif k == 16
pie(rand(1,10))
elseif k == 17
[x y] = meshgrid(-8 : 1 : 8);
r = sqrt(x.^2 + y.^2) + eps;
z = sin(r) ./ r;
ribbon(z)
elseif k == 18
t = 0:pi/40:4*pi;
y1 = sin(t);
y2 = exp(-0.2*t).*sin(2*t);
ribbon(t', y', 0.1)
elseif k == 19
x = 0:pi/40:pi;
stairs(x,sin(x))
elseif k == 20
t = 0:pi/50:2*pi;
r = exp(-0.05*t);
stem3(r.*sin(t), r.*cos(t),t)
elseif k == 21
[x y] = meshgrid(-2:0.1:2);
z = x.*exp(-x.^2-y.^2);
waterfall(z)
end
end
RESULTADOS
MENU PRINCIPAL

GRAFICOS CON 4 VISTAS

Vista 1

plot(2,2,1)

0.5

-0.5
30
20
10
0

10

25

20

15

Vista 2
plot(2,2,2)

0.5
0
-0.5
25
20

25
15

20
15

10

10

5
0

Vista 3
plot(2,2,3)
0.5

-0.5
0

Vista 4

10

20

30

10

15

20

25

plot(2,2,4)

0.5
0.4
0.3
0.2
0.1
0
-0.1
-0.2
-0.3
-0.4
-0.5

10

15

20

25

RECTA CON PENDIENTE


2

10

10

10

0.5

1.5

ROSA DE 4 PETALOS

2.5

3.5

90
120

1
0.8

60

0.6

150

30

0.4
0.2

180

210

330

240

300
270

LINEAS EN 2D
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4

10

GRAFICOS DE UNA MATRIZ

15

20

25

30

35

1
0.8
0.6
0.4
0.2
0
30
30

20

20

10

10
0

MEDIAS PARABOLAS
18
16
14
12
10
8
6
4
2
0

GRAFICO DE BARRAS

0.5

1.5

1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-0.5

0.5

1.5

2.5

LINEAS CONCENTRICAS

90

120

60

2
150

30
1

180

210

330

240

300
270

LINEAS VERTICALES

3.5

1.4
1.2
1
0.8
0.6
0.4
0.2
0
-0.2

0.2

0.4

0.6

0.8

1.2

HIPERBOLAS CONCENTRICAS
x 2-y 2
6

-2

-4

-6
-6

-4

LINEAS OBLICUAS

-2

0
x

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4

10

12

14

16

CIRCULO
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-1

GRAFICA SENO

-0.5

0.5

18

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1

10

12

14

BARRAS DELGADAS

2500

2000

1500

1000

500

0
-40

ONDAS 3D

-20

20

40

60

80

100

120

140

10
5
0
-5
-10
60
60

40

40

20

20
0

CIRCULO DE DISTRIBUCIONES

7%
2%

12%
2%

15%

9%

9%
17%

16%

BARRAS EN 3D

11%

0.5

-0.5
20
15
10
5
0

10

15

20

PARABOLA EN CUADROS
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0

0.5

ESCALERA CIRCULAR

1.5

2.5

3.5

8
6
4
2
0
1
0.5
0
-0.5
-1

-1

-0.5

0.5

ONDAS EN 3D

0.5

-0.5
60
40
20
0

10

20

30

40

50

También podría gustarte