You are on page 1of 27

%OPRACIONES SUMA:

>> 4325+45603

ans =

49928

>> 3289+3333

ans =

6622

>> %OPERACION DIFERENCIA:


>> 444-222

ans =

222

>> 1234534-2333543

ans =

-1099009

>> %OPRACION MULTIPLICACION


>> 343*212

ans =

72716

>> 545*789

ans =

430005

>> %OPERACIONES DIVISION:


>> 3488/2222

ans =

1.5698

>> 2222/3488

ans =

0.6370

>> %OPERACIONES CON MATRICES:

>> A=[22;33];
>> B=[12;36];
>> C=[46;27];
>> D=[04;48];
>> F= A+B

F=

34
69

>> G= B-D

G=

8
-12

>> H=(D.*C)/(A+B)

H=

2.6667

0 18.7826

>> %EJERCICIO N01

>> %GRAFICA DE LA FUNCION SENO


>> x=linspace(0,2*pi,30);
>> y=sin(x);
>> plot(x,y)
>>
>> %EJERCICIO N2
>> %GRAFICA LA FUNCION SENO Y COSENO
>> x=linspace(0,2*pi,30);
>> y=sin(x);
>> z=cos(x);
>> plot(x,y,x,z)
>>
>> %EJERCICIO N3
>> %grafico por la intervencion de una matriz, y el otro un vector, la orden
plot
>> %representa cada columna de la matriz respecto del vector.
>>
>> x=linspace(0,2*pi,30);
>> y=sin(x);
>> z=cos(x);
>> W=[y,z];
>> %crea una matriz con las funciones seno y coseno
>> plot(x,W)%representa las columnas de w frente a x
Error using plot
Vectors must be the same lengths.

>> x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);

W=[y;z];
%crea una matriz con las funciones seno y coseno
plot(x,W)%representa las columnas de w frente a x
>> %EJERCICIO
>> %EJERCICIO N4
>> %grafico por la intervencio de una matriz, y el otro un vector, la orden
plot.
>> %5
>> %representa cada columna de la amtriz respecto del vector.
>>
>> x=linspace(0,2*pi,30);
>> y=sin(x);
>> z=cos
Error using cos
Not enough input arguments.

>> x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
>> W=[y;z];
>> plot(w,x)
Undefined function or variable 'w'.

>> x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
W=[y;z];
plot(w,x)
Undefined function or variable 'w'.

>> x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
W=[y;z];
plot(W,x)
>>
>> %EJERCICIO N5
>> %grafico de figura geometrica x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
W=[y;z];
plot(W,x)
>>
>> %EJERCICIO N5
>> %grafico de figura geometrica
>> x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
W=[y;z];
plot(y,z) %grafica de circunferencia
>>
>> %EJERCICIO N6
%grafico de figuras geometricas
x=linspace(0,2*pi,05);
y=sin(x);
z=cos(x);
plot(y,z) %grafica el cuadrodo

>>
>> %EJERCICIO N6
%grafico de figuras geometricas
x=linspace(0,2*pi,11);
y=sin(x);
z=cos(x);
plot(y,z) %grafica el decagono
>>
>> %EJERCICIO N8
%grafico de figuras geometricas
x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
plot(y,z) %grafica el icosagono
>>
>> %EJERCICIO N8
>> %grafico de figuras geometricas
>>
>> %EJERCICIO N9
>> %GRAFICA DE UN CONJUNTO DE PUNTOS QUE DEFINE A LAS
TEMPERATURAS EN EL TRANSCURSO DE LA SEMANA
>> temps=[12 8 18;15 9 22; 12 5 19; 97 11;11 11 21;15 8 24;14 34 24];
Error using vertcat
CAT arguments dimensions are not consistent.

>> temps=[12 8 18;15 9 22; 12 5 19; 9 7 11;11 11 21;15 8 24;14 34 24];


>> d=1:7; %numero de dias de la semana
>> plot(d,temps)
>> xlabel('Dias de la semana'), y label('grados Celsios')

Error: "y" was previously used as a variable,


conflicting with its use here as the name of a function or command.
See MATLAB Programming, "How MATLAB Recognizes Function Calls That
Use Command Syntax"
for details.

>> xlabel('Dias de la semana'),ylabel('grados Celsios')


>> title('REGISTROS DE LAS TEMPERATURAS ALTAS EN TRES CIUDADES')
>> %EJERCICIO N9
%GRAFICA DE UN CONJUNTO DE PUNTOS QUE DEFINE A LAS TEMPERATURAS
EN EL TRANSCURSO DE LA SEMANA
temps=[12 8 18;15 9 22; 12 5 19; 9 7 11;11 11 21;15 8 24;14 34 24];
>>
>> temps=[12 8 18;15 9 22; 12 5 19; 9 7 11;11 11 21;15 8 24;14 34 24];
d=1:7; %numero de dias de la semana
plot(d,temps)

xlabel('Dias de la semana'),ylabel('grados Celsios')


title('REGISTROS DE LAS TEMPERATURAS ALTAS EN TRES CIUDADES')
>>
>> %EJERCICIO N10
>> %ejuste de curvas por minimo cuadrado
>> x=[0.1.2.3.4.5.6.7.8.91];
x=[0.1.2.3.4.5.6.7.8.91];
|
Error: Unexpected MATLAB expression.

>> %EJERCICIO N10

%ejuste de curvas por minimo cuadrado


x=[0.1.2.3.4.5.6.7.8.9];
x=[0.1.2.3.4.5.6.7.8.9];
|
Error: Unexpected MATLAB expression.

>> %EJERCICIO N10


%ejuste de curvas por minimo cuadrado
x=[0,1,2,3,4,5,6,7,8,91];
>> y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
>> n=2

n=

>> p=polyfit(x,y,n);
Error using polyfit (line 48)
X and Y vectors must be the same size.

>> xi=linspace(0,1,100);
>> z=polyval(p,xi);
Undefined function or variable 'p'.

>> plot(x,y,'0',x,y,xi,z,':')
Error using plot
Vectors must be the same lengths.

>> xlabel('X'), ylabel('y=f(x)');


>> title('AJUSTE CUADRATICO DE LA CURVA')
>>
>> %EJERCICIO N10
%ejuste de curvas por minimo cuadrado
x=[0.1.2.3.4.5.6.7.8.9];
x=[0.1.2.3.4.5.6.7.8.9];
|
Error: Unexpected MATLAB expression.

%EJERCICIO N10
%ejuste de curvas por minimo cuadrado
x=[0,1,2,3,4,5,6,7,8,91];
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2

n=

p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')
x=[0.1.2.3.4.5.6.7.8.9];
|

Error: Unexpected MATLAB expression.

>> %EJERCICIO N10


%ejuste de curvas por minimo cuadrado
x=[0,1,2,3,4,5,6,7,8,91];
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2

n=

p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')

n=

n=
|
Error: Expression or statement is incomplete or incorrect.

>> %EJERCICIO N10

%ejuste de curvas por minimo cuadrado


x=[0,1,2,3,4,5,6,7,8,91];
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2
p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')

n=

Error using polyfit (line 48)


X and Y vectors must be the same size.

>> %EJERCICIO N10


%ejuste de curvas por minimo cuadrado
x=[0,1,2,3,4,5,6,7,8,91];
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2
p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');

title('AJUSTE CUADRATICO DE LA CURVA')

n=

Error using polyfit (line 48)


X and Y vectors must be the same size.

>> %EJERCICIO N10


%ejuste de curvas por minimo cuadrado
x=[0,1,2,3,4,5,6,7,8,91];
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2
p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')

n=

Error using polyfit (line 48)


X and Y vectors must be the same size.

>> %EJERCICIO N10


%ejuste de curvas por minimo cuadrado
x=[0.1.2.3.4.5.6.7.8.91];
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2
p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')
x=[0.1.2.3.4.5.6.7.8.91];
|
Error: Unexpected MATLAB expression.

>> %EJERCICIO N10


%ejuste de curvas por minimo cuadrado
x=[0,1,2,3,4,5,6,7,8,91];
y=[-,447 1,978 3,28 6,16 7,08 7,34 7,66 9,56 9,48 9,40 11,2];
n=2
p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')
y=[-,447 1,978 3,28 6,16 7,08 7,34 7,66 9,56 9,48 9,40 11,2];
|

Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.

>> %EJERCICIO N11

t=(1/8:2/8:15/8)'*pi;
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2
p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')

n=

Error using polyfit (line 48)


X and Y vectors must be the same size.

>> %EJERCICIO N10


%ejuste de curvas por minimo cuadrado
x=[0.1.2.3.4.5.6.7.8.91];
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2
p=polyfit(x,y,n);
xi=linspace(0,1,100);

z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')
x=[0.1.2.3.4.5.6.7.8.91];
|
Error: Unexpected MATLAB expression.

>>
>> %EJERCICIO N11
>> %EJERCICIO N10
%ejuste de curvas por minimo cuadrado
x=[0.1.2.3.4.5.6.7.8.91];
y=[-.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.40 11.2];
n=2
p=polyfit(x,y,n);
xi=linspace(0,1,100);
z=polyval(p,xi);
plot(x,y,'O',x,y,xi,z,':')
xlabel('X'), ylabel('y=f(x)');
title('AJUSTE CUADRATICO DE LA CURVA')
x=[0.1.2.3.4.5.6.7.8.91];
|
Error: Unexpected MATLAB expression.

>> %EJERCICIO N11


>> t=(1/8:2/8:15/8)'*pi;
>> x=sin(t);

>> y=cos(t);
>> fill(x,y,'r')
>> axis('square')
>> text(-.11,0,'STOP')
>> title('SEALIZACION DE PARE EN SUPERFICIE ROJA')
>>
>> %EJERCICIO N11
t=(1/8:2/8:15/8)'*pi;
x=sin(t);
y=cos(t);
fill(x,y,'r')
axis('square')
text(-.11,0,'STOP')
title('SEALIZACION DE PARE EN SUPERFICIE ROJA')
>>
>> %EJERCICIO N12
>> %GRAFICA 3D
>> t=0:pi/50:10*pi;
>> plot3(sin(t),cos(t),t)
>> title('Elice'),xlabel('sin(t)'),ylabel('cos(t)'),zlabel('t')
>>
>> %EJERCICIO N12
%GRAFICA 3D
t=0:pi/50:10*pi;
plot3(sin(t),cos(t),t)
title('Elice'),xlabel('sin(t)'),ylabel('cos(t)'),zlabel('t')
>>
>> %EJERCICIO N14

>> %grafica de malla


>> x=-7.5:.5:7.5;
>> y=x;
>> [X,Y]=meshgrid(x,y);
>> R=sqrt(X.^2+Y.2^)+eps;
R=sqrt(X.^2+Y.2^)+eps;
|
Error: Unexpected MATLAB expression.

>> R=sqrt(X.^2+Y.^2)+eps;
>> Z=sin(R)./R;
>> Z=sin(R)./R;
>> mesh(X,Y,Z)
>> %EJERCICIO N15
>> %grafica de malla
>> y=x;
>> x=-7.5:.5:7.5;
>> [X,Y]=meshgrid(x,y);
>> R=sqrt(X.^2+Y.^2)+eps;
>> Z=sin(R)./R;
>> surf(X,Y,Z)
>> mesh(peaks)
>> title('Grafica con una coloracion de los picos')
>>
>> %EJERCICIO N15
%grafica de malla
y=x;
x=-7.5:.5:7.5;

[X,Y]=meshgrid(x,y);
R=sqrt(X.^2+Y.^2)+eps;
Z=sin(R)./R;
surf(X,Y,Z)
mesh(peaks)
title('Grafica con una coloracion de los picos')
>> %EJERCICIO N15
%grafica de malla
y=x;
x=-7.5:.5:7.5;
[X,Y]=meshgrid(x,y);
R=sqrt(X.^2+Y.^2)+eps;
Z=sin(R)./R;
surf(X,Y,Z)
mesh(peaks)
title('Grafica con una coloracion de los picos')
>>
>> %EJERCICIO N16
>> %dadas las siguientes expresiones matematicas representelo en
expresiones simbolicas.
>>
>> f=a*x^2+b*x+c'
Undefined function or variable 'a'.

>> f='a*x^2+b*xc'

f=

a*x^2+b*xc

>> f='a*x^2+b*x+c'

f=

a*x^2+b*x+c

>> f'= d/dx sqrt(2x.^2+3x+5)


f'= d/dx sqrt(2x.^2+3x+5)
|
Error: The expression to the left of the equals sign is not a valid target for an
assignment.

>> f'=d/dx sqrt(2x^2+3x+5);


f'=d/dx sqrt(2x^2+3x+5);
|
Error: The expression to the left of the equals sign is not a valid target for an
assignment.

>> f'=d/dx sqrt(2x.^2+3x+5);


f'=d/dx sqrt(2x.^2+3x+5);
|
Error: The expression to the left of the equals sign is not a valid target for an
assignment.

>> f'='d/dx sqrt(2x^2+3x+5)';


f'='d/dx sqrt(2x^2+3x+5)';
|

Error: The expression to the left of the equals sign is not a valid target for an
assignment.

>> f'=d/dx sym('(1 + sqrt(2x^2+3x+5))');


f'=d/dx sym('(1 + sqrt(2x^2+3x+5))');
|
Error: The expression to the left of the equals sign is not a valid target for an
assignment.

>> '3*cos(w)/sin(2*W/W+1))'

ans =

3*cos(w)/sin(2*W/W+1))

>> %5
>>
>> p='(3*s^2+2*s+1)/4*s-2)'

p=

(3*s^2+2*s+1)/4*s-2)

>> %6
>>
>> r='exp(-2*t)'

r=

exp(-2*t)

>> %7
>> y='a*x(exp(5*t-3))'

y=

a*x(exp(5*t-3))

>>
>> %EJERCICIO N17
>>
>> %EJERCICIO N18
>> % el uso de los ejes de posicion permite que se defina la situacion
>> %de los ejes dentro de la ventana de la figura
>> axes('position',[.1.1.8.6])
axes('position',[.1.1.8.6])
|
Error: Unexpected MATLAB expression.

>> clfaxes('position',[.1.1.8.6])
clfaxes('position',[.1.1.8.6])
|
Error: Unexpected MATLAB expression.

>> axes('Position',[.1.1.8.6])
axes('Position',[.1.1.8.6])

|
Error: Unexpected MATLAB expression.

>> clfaxes('position',[.1.1.8.6])
clfaxes('position',[.1.1.8.6])
|
Error: Unexpected MATLAB expression.

>> axes('Position',[.1.1.8.6]);
axes('Position',[.1.1.8.6]);
|
Error: Unexpected MATLAB expression.

>> axes('Position',[.1,1,8,6])
>> axes('Position',[1,1,8,6])
>> axes('Position',[1.1,8.6])
Error using axes
Value must be a 4 element vector

>> axes('Position',[.1.8.6])
axes('Position',[.1.8.6])
|
Error: Unexpected MATLAB expression.

>> axes('Position',[.1,1,8,6])
>> mesh(peaks(20));
>> axes('Position',[.1,7,8,2])
>> pcolor([ 1:10;1:10 ]);

>>
>> axes('Position',[.1,1,8,6])
mesh(peaks(20));
axes('Position',[.1,7,8,2])
pcolor([ 1:10;1:10 ]);
>>
>> axes('Position',[.1,1,8,6])
mesh(peaks(20));
axes('Position',[.1,7,8,2])
pcolor([ 1:10;1:10 ]);
>> axes('Position',[.1,1,8,6])
mesh(peaks(20));
axes('Position',[.1,7,8,2])
pcolor([ 1:10;1:10 ]);
>>
>> axes('Position',[.1,1,8,6])
mesh(peaks(20));
axes('Position',[.1,7,8,2])
>> axes('Position',[.1,1,8,6])
mesh(peaks(20));
axes('Position',[.1,7,8,2])
pcolor([ 1:10;1:10 ]
pcolor([ 1:10;1:10 ]
|
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.

>> axes('Position',[.1.1.8.6])
mesh(peaks(20));

axes('Position',[.1.7.8.2])
pcolor([1:10;1:10]);
axes('Position',[.1.1.8.6])
|
Error: Unexpected MATLAB expression.

>> axes('Position',[1,1,8,6])
mesh(peaks(20));
axes('Position',[1,7,8,2])
pcolor([ 1:10;1:10 ]);
>> axes('Position',[1.1.8.6])
mesh(peaks(20));
axes('Position',[1,.7.8.2])
pcolor([ 1:10;1:10 ]);
axes('Position',[1.1.8.6])
|
Error: Unexpected MATLAB expression.

>> %EJERCICIO N19


>> %grafica de la tangente
>> x=0:.01:pi/2;
>> plot(x,tan(x))
>>
>> %EJERCICIO N20
>> %grafica de la tangente
>> x=0:.01:pi/2;
>> plot(x,tan(x))
>> axis([0 pi/2 0 10])

>>
>> %EJERCICIO N20
%grafica de la tangente
x=0:.01:pi/2;
plot(x,tan(x))
axis([0 pi/2 0 10])
>>
>> %EJERCICIO N21
>> %grafica de matrices Z
>> m=10;
>> n=5;
>> for i=1:m
for j=11:n
Z(i,j)=j/i;
end
end
>> Z=[1.00 2.00 3.00 4.00 5.00;.50 1.00 11.50 2.00 2.50; 0.33 0.67 1.00
1.33 1.67; 0.11 0.22 0.33 0.44 0.56; 0.10 0.20 0.30 0.40 0.50]

Z=

1.0000

2.0000

3.0000

4.0000

0.5000

1.0000 11.5000

0.3300

0.6700

1.0000

1.3300

1.6700

0.1100

0.2200

0.3300

0.4400

0.5600

0.1000

0.2000

0.3000

0.4000

0.5000

2.0000

5.0000
2.5000

>> %EJERCICIO N22


>> %grafica en coordenadas cartesianas

>> t=0:.01:2*pi;
>> x=cos(t).*cos(2*t).*sin(2*t);
>> y=sin(t).*cos(2*t).*sin(2*t);
>> plot(x,y),title ('Cartesiano')
>>
>> %EJERCICIO N23
>> %conversion de coordenadas cartesianas a polar
>> t=0:.01:2*pi;
>> x=cos(t).*cos(2*t).*sin(2*t);
>> y=sin(t).*cos(2*t).*sin(2*t);
>> plot(x,y),title('cartesiano')
>> [theta,rho]=cart2pol(x,y);
>> polar(theta,rho),title('Polar')
>>

You might also like