Académique Documents
Professionnel Documents
Culture Documents
1 MATLAB
2 PC Pentium II-actual.
3 Manual de MATLAB.
IV PROCEDIMIENTO:
1 Desarrolle en el programa principal de MATLAB los siguientes ejemplos y anotar sus
resultados.
1.1 Funciones matemticas:
>> x=sqrt(2)/2
x = 0.7071
>> y=asin(x)
y = 0.7854
>> y_deg=y*180/pi %convierte grados a radianes
y_deg = 45.0000
>> x=sqrt(3^2+4^2)
x= 5
>> y=rem(23,4)
y= 3
>> x=2.6,y1=fix(x),y2=floor(x),y3=ceil(x),y4=round(x);
x = 2.6000
y1 = 2
y2 = 2
y3 = 3
y4= 3
1.2 Nmeros complejos:
>> a=1;b=5;c=6
c= 6
>> x1=(-b+sqrt(b^2-4*a*c))/(2*a)
x1 = -2
>> x2=(-b-sqrt(b^2-4*a*c))/(2*a)
x2 = -3
>> a=1,b=4,c=13;
a=1
b=4
>> x1=(-b+sqrt(b^2-4*a*c))/(2*a)
x1 = -2.0000 + 3.0000i
>> x2=(-b-sqrt(b^2-4*a*c))/(2*a)
x2 = -2.0000 - 3.0000i
>> a*x1^2+b*x1+c
ans = 0
>> a*x2^2+b*x2+c
ans = 0
>> C1=1-2i
C1 = 1.0000 - 2.0000i
>> C1=1-2j
C1 = 1.0000 - 2.0000i
>> C2=3*(2-sqrt(-1)*3)
C2 = 6.0000 - 9.0000i
>> c3=sqrt(-2)
c3 = 0 + 1.4142i
>> c4=6+sin(.5)*i
c4 = 6.0000 + 0.4794i
>> c5=6+sin(.5)*j
c5 = 6.0000 + 0.4794i
>> C1=1-2i
C1 = 1.0000 - 2.0000i
>> mag_c1=abs(c1)
mag_c1 = 2.2361
>> angle_c1=angle(c1)
angle_c1 = -1.1071
>> deg_c1=angle_c1*180/pi
deg_c1 = -63.4349
>> real_c1=real(c1)
real_c1 = 1
>> imag_c1=imag(c1)
imag_c1 = -2
1.3 Construccion de arrays:
>> x=[0 .1*pi .2*pi .3*pi .4*pi .5*pi .6*pi .7*pi .8*pi .9*pi pi]
x = Columns 1 through 4
0 0.3142 0.6283 0.9425
Columns 5 through 8
1.2566 1.5708 1.8850 2.1991
Columns 9 through 11
2.5133 2.8274 3.1416
>> y=sin(x)
y = Columns 1 through 4
0 0.3090 0.5878 0.8090
Columns 5 through 8
0.9511 1.0000 0.9511 0.8090
Columns 9 through 11
0.5878 0.3090 0.0000
>> x(1:5),
ans = Columns 1 through 4
0 0.3142 0.6283 0.9425
Column 5
1.2566
>> x=(0:0.1:1)*pi
x = Columns 1 through 4
0 0.3142 0.6283 0.9425
Columns 5 through 8
1.2566 1.5708 1.8850 2.1991
Columns 9 through 11
2.5133 2.8274 3.1416
>> x=linspace(0,pi,11)
x = Columns 1 through 4
0 0.3142 0.6283 0.9425
Columns 5 through 8
1.2566 1.5708 1.8850 2.1991
Columns 9 through 11
2.5133 2.8274 3.1416
2.
2.1Grafica de funciones trigonomtricas:
x=linspace(0,4*pi,60);
y=sin(x);
figure(1)
plot(x,y)
z=cos(x);
figure(2)
plot(x,z,x,y)
figure(3)
plot(x,y,x,y,'*')
figure(4)
plot(y,z)
figure(5)
plot(x,y,x,2*y.*z,'--')
grid
xlabel('variable independiente x')
ylabel('variables dependientes')
title('2sen(x)cos(x)sen(2x)')
figure(6)
plot3(y,z,x),grid
x=linspace(0,16,100);
y=sin(x);
z=(y>=0).*y;
z=z+0.5*(y<0);
z=(x<=14).*z;
plot(x,z)
xlabel('x'),ylabel('Z=f(x)')
title('seal discontinua')
CUESTIONARIO
c5 = 6.0000 + 0.4794i
>> C1=1-2i
C1 =1.0000 - 2.0000i
>> c1=1-2j
c1 =1.0000 - 2.0000i
>> mag_c1=abs(c1)
mag_c1 = 2.2361
>> angle_c1=angle(c1)
angle_c1 = -1.1071
>> deg_c1=angle_c1*180/pi
deg_c1 = -63.4349
>> real_c1=real(c1)
real_c1 = 1
>> imag_c1=imag(c1)
imag_c1 = -2
1.3 Construccin de arrays:
1
>> x=[0 .1*90 .2*90 .3*90 .4*90 .5*90 .6*90 .7*90 .8*90 .9*90 90]
x=
Columns 1 through 8
0 9.0000 18.0000 27.0000 36.0000 45.0000 54.0000 63.0000
Columns 9 through 11
72.0000 81.0000 90.0000
>> y=cos(x*pi/180)
y=
Columns 1 through 8
1.0000 0.9877 0.9511 0.8910 0.8090 0.7071 0.5878 0.4540
Columns 9 through 11
0.3090 0.1564 0.0000
>> x(2)
ans =
9
>> x(4)
ans =
27
>> x(6)
ans =
45
>> x=(0:0.1:1)*90
x=
Columns 1 through 8
0 9.0000 18.0000 27.0000 36.0000 45.0000 54.0000 63.0000
Columns 9 through 11
72.0000 81.0000 90.0000
plot(x,y,x,2*y.*z,'--')
grid
xlabel('variable independiente x')
ylabel('variables dependientes')
title('2sen(x)cos(x)sen(2x)')
figure(6)
plot3(y,z,x),grid