Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Tarea # 3-MODELACIÓN DE SISTEMAS DE ENERGÍA ELÉCTRICA
Tarea # 3-MODELACIÓN DE SISTEMAS DE ENERGÍA ELÉCTRICA
PRACTICA Nº 1
>> 2+3
ans =
>> 3-2
ans =
>> 2*3
ans =
>> 1 / 2
ans =
0.5000
>> 2^2
ans =
>> 2\1
ans =
0.5000
>> 2.*3
ans =
>> 1./2
ans =
0.5000
>> 2.^2
ans =
>> pi
ans =
3.1416
>> sqrt(pi)
ans =
1.7725
>> whos
Name Size Bytes Class Attributes
>> x=0:10
x=
0 1 2 3 4 5 6 7 8 9 10
>> size(x)
ans =
1 11
>> x=0:10;
>> size(x)
ans =
1 11
>> x
--------------------------------------------------------------0--------------------------------------------------------------
Gráfica Seno
x=
0 1 2 3 4 5 6 7 8 9 10
>> x=0:0.1:10;
>> z=sin(x);
>> plot(x,z),grid
--------------------------------------------------------------0--------------------------------------------------------------
Método Matricial
z=
2
1
--------------------------------------------------------------0--------------------------------------------------------------
[x y] = meshgrid(-8 : 0.5 : 8);
>> r = sqrt(x.^2 + y.^2) + eps;
>> z = sin(r)./ r;
>> mesh(z);
--------------------------------------------------------------0--------------------------------------------------------------
Probando los sonidos
>> why
The bald and not excessively bald and not excessively smart hamster obeyed a terrified and
not excessively terrified hamster.
>> why
To fool the tall good and smart system manager.
>> why
The rich rich and tall and good system manager suggested it.
--------------------------------------------------------------0--------------------------------------------------------------
x = 0: pi/20: 6*pi;
plot(x, exp(-0.2*x) .* sin(x), 'r'),grid
‘b’
--------------------------------------------------------------0--------------------------------------------------------------
>> x=[1 3 0 -1 5]
x=
1 3 0 -1 5
>> x'
ans =
1
3
0
-1
5
--------------------------------------------------------------0--------------------------------------------------------------
>> a=[1 2 3; 4 5 6]
a=
1 2 3
4 5 6
--------------------------------------------------------------0--------------------------------------------------------------
>> x=0:30:180;
>> tabla = [x' sin(x*pi/180)']
tabla =
0 0
30.0000 0.5000
60.0000 0.8660
90.0000 1.0000
120.0000 0.8660
150.0000 0.5000
180.0000 0.0000
--------------------------------------------------------------0--------------------------------------------------------------
>> eye(4)
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
>> zeros(3,5)
ans =
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
>> zeros(4)
ans =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
>> ones(3)
ans =
1 1 1
1 1 1
1 1 1
>> ones(2,4)
ans =
1 1 1 1
1 1 1 1
>> ones(3)
ans =
1 1 1
1 1 1
1 1 1
>> ones(2,4)
ans =
1 1 1 1
1 1 1 1
Seudo aleatorio
ans =
--------------------------------------------------------------0--------------------------------------------------------------
g=9.8
vl=60;
t=0:0.01:12.3;
d=vl*t-(1/2)*g*t.^2
plot(t,d), title('Movimiento vertical bajo gravedad')
xlabel('Tiempo')
ylabel('Desplazamiento vertical'),grid
--------------------------------------------------------------0--------------------------------------------------------------
Números Complejos
x1 =
-2.0000 + 3.0000i
>> x2=(-b-sqrt(b^2-4*a*c))/(2*a)
x2 =
-2.0000 - 3.0000i
>> %comprobando
>> a*x1^2+b*x1+c
ans =
--------------------------------------------------------------0--------------------------------------------------------------
INPUT
10
nombre =
--------------------------------------------------------------0--------------------------------------------------------------
DISP
A=
>> disp(A)
0.2575 0.2435 0.2511 0.8308
0.8407 0.9293 0.6160 0.5853
0.2543 0.3500 0.4733 0.5497
0.8143 0.1966 0.3517 0.9172
--------------------------------------------------------------0--------------------------------------------------------------
clear
clc
%Problema del proyectil v(pelota de golf)con resistencia cero del aire
en
%un g=gravedad.
disp (' Movimiento de una pelota de golf')
disp (' ---------------------------------')
disp (' ')
%1. Definición de las variables de entrada
g = 9.81; %Gravedad en m/s
vo=input('¿Cual es la Velocidad de lanzamiento en m/s? ')
tho=input('¿Cual es el ángulo de lanzamiento en grados? ')
tho = pi*tho/180; %Conversiòn de grados a radianes.
%2. Calculo del rango y duración del vuelo
txmax = (2*vo/g) * sin(tho);
xmax = txmax * vo * cos(tho);
%3. Calculo de la secuencia de tiempo por pasos para calcular la
%trayectoria.
dt = txmax/100;
t = 0:dt:txmax;
%4. Calculo de la trayectoria
x = (vo * cos(tho)) .* t;
y = (vo * sin(tho)) .* t - (g/2) .* t.^2;
%5. Calculo de la velocidad dy dirección angular del proyectil Nota
que
%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);
%6. Calculo del tiempo, distancia horizontal a la máxima altitud
tymax = (vo/g) * sin(tho);
xymax = xmax/2;
ymax = (vo/2) * tymax * sin(tho);
%7. Mostrar resultados.
disp(['Rango en m = ',num2str(xmax),' Duración en s =
',num2str(txmax)])
disp(' ')
disp(['Maxima altitud en m = ',num2str(ymax),' Arriba 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. ángulo')
xlabel('v'), ylabel('\theta') % Figura 2.
%
%8. Stop.
%
vo =
10
tho =
45
MATRICES DE NÚMEROS
c=
3 12 10
17 18 35
7 10 24
>> x
x=
4 0 0
6 6 0
0 3 5
>> m=c*x
m=
84 102 50
176 213 175
88 132 120
>> suma=c+x
suma =
7 12 10
23 24 35
7 13 29
>> res=c-x
res =
-1 12 10
11 12 35
7 7 19
>> c
c=
3 12 10
17 18 35
7 10 24
>> c'
ans =
3 17 7
12 18 10
10 35 24
>> inversa=inv(c)
inversa =
--------------------------------------------------------------0--------------------------------------------------------------
Múltiples Gráficos
clc
clear
disp('Múltiples gráficos')
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)')
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)')
>> [x y]=meshgrid(-2:.2:2);
>> z=x.*exp(-x.^2-y.^2);
>> meshc(z)
>> a=zeros(30,30);
>> a(:,15) = 0.2*ones(30,1);
>> a(7,:) =0.1*ones(1,30);
>> a(15,15) = 1;
>> mesh (a)