Professional Documents
Culture Documents
para
1
2
f(x) = e-x
0.9
grafica2d01.m (script)
0.8
clc; clear;
0.7
x = (-3:0.01:3);
y = exp(-x.^2);
0.6
Eje Y
01.
02.
03.
04.
05.
06.
07.
plot(x,y);
grid on;
0.5
0.4
0.3
0.2
Ejecucin:
0.1
>> grafica2d01
0
-3
-2
-1
0
Eje X
1
0.9
0.8
0.7
Eje x: [ 4; 4]
0.6
0.5
grafica2d03.m (script)
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
0.4
0.3
0.2
0.1
0
-3
-2
-1
2. Aada el cdigo necesario al script anterior de manera que la graca disponga de:
Ttulo
clc; clear;
x = (-3:0.01:3);
y = exp(-x.^2);
plot(x,y);
grid on;
title(Grafica de funcion bidimensional);
xlabel(Eje X);
ylabel(Eje Y);
legend(f(x) = e^{-x^2});
axis([-4 4 -0.5 1.5]);
Ejecucin:
>> grafica2d03
Leyenda
Grfica de funcin bidimensional
1.5
grafica2d02.m (funcin)
clc; clear;
1
x = (-3:0.01:3);
y = exp(-x.^2);
plot(x,y);
grid on;
Eje Y
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
2
f(x) = e-x
0.5
-0.5
-4
Ejecucin:
>> grafica2d02
1
-3
-2
-1
0
Eje X
4. Implemente un script que permita gracar en una misma ventana las funciones
Ejecucin:
x2
f1 (x) = e
f2 (x) = 3e
>> grafica2d05
x2
Eje x: [ 4; 4]
2
f(x) = e-x
grafica2d04.m (script)
clc; clear;
Eje Y
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
x = (-3:0.01:3);
y1 = exp(-x.^2);
y2 = exp(-3*x.^2);
plot(x, y1, x, y2);
grid on;
0.5
-0.5
-4
-3
-2
-1
0
Eje X
Ejecucin:
6. Codique un script que graque la funcin de densidad normal
>> grafica2d04
Grfica de funcin bidimensional
f x; ;
1.5
f1(x) = e-x
2
f2(x) = e-3x
1
= p exp
2
1
2
Eje Y
grafica2d06.m (script)
-0.5
-4
-3
-2
-1
0
Eje X
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
clc; clear;
x = (-3:0.01:3);
y = exp(-x.^2);
plot(x, y, -r,...
[-4 4], [0 0], -k, ...
[0 0], [-0.5 1.5], -k);
grid on;
% f(x)
% eje horizontal
% eje vertical
clc; clear;
mu
= 0;
sigma = 1;
x = (-3:0.01:3);
% Calculo de y = f(x) densidad normal con x~N(0,1)
y = (1/(sigma*sqrt(2*pi)))*exp(-0.5*((x-mu)/sigma).^2);
plot(x, y, -b,...
[-4 4], [0 0], -k, ...
[0 0], [0 0.5], --r);
grid on;
% f(x)
% eje horizontal
% eje vertical (media)
Ejecucin:
>> grafica2d06
EXPOSITOR: Miguel Ataurima Arellano
mataurimaa@uni.pe
grafica2d08.m (script)
01.
02.
03.
04.
05.
06.
07.
08.
Eje Y
0.25
0.2
0.15
0.1
0.05
-3
-2
-1
0
Eje X
x = (-4+mu:0.01:4+mu);
clc; clear;
mu
= 5;
sigma = 1;
x = (-3+mu:0.01:3+mu);
Ejecucin:
>> grafica2d07
% f(x)
% eje horizontal
% eje vertical
0.45
y 2 = f(x) : x ~ N(5,1.5)
0.4
y 3 = f(x) : x ~ N(5,3)
0.35
0.3
Eje Y
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
mu
= 5;
sigma = 1;
0.3
0
-4
clc; clear;
0.25
0.2
Ejecucin:
0.15
>> grafica2d07
0.1
0.05
Grfica de la funcin de densidad normal
0.5
y = f(x) : x ~ N(5,1)
0.45
5
Eje X
0.4
9. Implemente un script que graque una secuencia fyt gTt=1 tipo caminata
aleatoria
t
X
yt = 50 +
xt
0.35
Eje Y
0.3
0.25
k=1
0.2
0.15
0.1
grafica2d09.m (script)
0.05
0
5
Eje X
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
clc; clear;
% Talla de la muestra
T = 500;
% Intervalo de tiempo
t = (1:T);
% Especificacion de semilla
rng(123);
mataurimaa@uni.pe
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
% x~N(0,1)
x = randn(T,1);
% y : Caminata Aleatoria
y = 50 + cumsum(x);
% Grafica
plot(t,y);
xlabel(t);
ylabel(y_t);
grid on;
Ejecucin:
>> grafica2d10
Ejecucin:
>> grafica2d09
Variables en Niveles
65
x t: GWN
80
y t: RW
60
55
40
yt
x t, y t
60
50
20
0
45
-20
40
50
100
150
200
250
t
300
350
400
450
50
100
150
200
500
250
t
300
350
400
450
Variacin Porcentual
500
%y t
10
-5
%yt =
Aproximada:
yt
yt
%yt
-10
ln
yt
yt
50
100
150
200
250
t
300
350
400
450
500
clc; clear;
grafica2d11.m (script)
% Talla de la muestra
T = 500;
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
% Intervalo de tiempo
t = (1:T);
% Especificacion de semilla
rng(123);
% x~N(0,1)
x = randn(T,1);
% y : Caminata Aleatoria
y = 50 + cumsum(x);
% Variacion porcentual de y
dpy1 = y(2:T)./y(1:T-1)-1;
% Aprox. de la Variacion porcentual de y
dpy2 = log( y(2:T)./y(1:T-1) );
% Graficas
subplot(2,1,1);
plot(t, x, ... % GWN: Ruido Blanco Gaussiano
t, y);
% RW: Caminata Aleatoria
title(Variables en Niveles);
xlabel(t);
ylabel(x_t, y_t);
grafica2d10.m (script)
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
clc; clear;
% Talla de la muestra
T = 500;
% Intervalo de tiempo
t = (1:T);
% Especificacion de semilla
rng(123);
% x~N(0,1)
x = randn(T,1);
% y : Caminata Aleatoria
y = 50 + cumsum(x);
% Variacion porcentual de y
dpy1 = y(2:T)./y(1:T-1)-1;
% Aprox. de la Variacion porcentual de y
dpy2 = log( y(2:T)./y(1:T-1) );
% Graficas
subplot(2,1,1);
plot(t, x, ... % GWN: Ruido Blanco Gaussiano
t, y, ... % RW: Caminata Aleatoria
[0 T], [50 50], :r);
mataurimaa@uni.pe
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
title(Variables en Niveles);
xlabel(t);
ylabel(x_t, y_t);
legend(x_t: GWN, y_t: RW);
grid on;
subplot(2,1,2);
plot( t(2:T), 100*dpy1, b-, ...
t(2:T), 100*dpy2, r--);
title(Variaci\U{f3}n Porcentual);
xlabel(t);
ylabel(\Delta%y_t);
legend(\Delta%y_t, log(y_t/y_{t-1}));
grid on;
title(Variables en Niveles);
xlabel(t);
ylabel(x_t, y_t);
legend(x_t: GWN, y_t: RW);
grid on;
subplot(2,1,2);
plot( t(2:T), 100*dpy1, b-, ...
t(2:T), 100*dpy2, r--);
title(Variaci\U{f3}n Porcentual);
xlabel(t);
ylabel(\Delta%y_t);
legend(\Delta%y_t, log(y_t/y_{t-1}));
grid on;
Ejecucin:
Ejecucin:
>> grafica2d11
>> grafica2d12
Variables en Niveles
100
150
y t: RW
y t: RW
100
x t, y t
x t, y t
50
-50
x t: GWN
Variables en Niveles
x t: GWN
50
0
-50
50
100
150
200
250
300
t
Variacin Porcentual
350
400
450
500
%y t
10
50
100
150
200
250
300
t
Variacin Porcentual
350
400
450
500
%y t
%y t
%y t
5
0
-5
-10
-5
0
50
100
150
200
250
t
300
350
400
450
500
t
X
100
150
200
250
t
300
350
400
450
500
xt
Graque la serie del PBI real de EEUU en billones de US$ del 2000, con
una frecuencia trimestal comprendida en el periodo 1947Q1 al 2005Q3
junto a al PBI tendencial.
k=1
grafica2d12.m (script)
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
50
clc; clear;
Graque las variaciones porcentuales del PBI real de EEUU.
% Talla de la muestra
T = 500;
grafica2d13.m (script)
% Intervalo de tiempo
t = (1:T);
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
% Especificacion de semilla
rng(123);
% x~N(0,1)
x = randn(T,1);
% y : Caminata Aleatoria
y = 50 + 0.1*t + cumsum(x);
% Variacion porcentual de y
dpy1 = y(2:T)./y(1:T-1)-1;
% Aprox. de la Variacion porcentual de y
dpy2 = log( y(2:T)./y(1:T-1) );
% Graficas
subplot(2,1,1);
plot(t, x, ... % GWN: Ruido Blanco Gaussiano
t, y, ... % RW: Caminata Aleatoria
[0 T], [50 50+0.1*T], :r);
clc; clear;
% Cargamos datos
% PBI de EEUU en billones de US$ del 2000
% Frecuencia: Trimestal
% Periodo: 1947Q1 - 2005Q3
load Data_GNP;
% Obtenemos fechas (trimestrales)
gnpdate = dates;
% Obtenemos al serie PBI real
realgnp = Dataset.GNPR;
% Descompocision Tendencia - Ciclo
% mediante el us del Filtro Hodrick-Prescott
[Tendencia, Ciclo] = hpfilter(realgnp, 1600);
% Grafica
figure(1);
subplot(3,1,1);
plot(gnpdate, realgnp, ...
gnpdate, Tendencia, r);
% Serie GNP
% Tendencia GNP
mataurimaa@uni.pe
04.
05.
06.
07.
08.
09.
subplot(3,1,2);
10.
plot(gnpdate, Ciclo, ...
% Ciclo GNP
11.
[gnpdate(1) gnpdate(end)], [0 0], -k);
12.
xlabel(tiempo (Trimestres));
13.
ylabel(Billones de US$ del 2000);
14.
legend(Ciclo del PBI real);
15.
grid on;
16.
17.
subplot(3,1,3);
18.
T = length(dates);
19.
dprealgnp = realgnp(5:T)./realgnp(1:T-4) - 1;
plot(gnpdate(5:T), 100*dprealgnp, ... % Var. porcentual del GNP 20.
21.
[gnpdate(1) gnpdate(end)], [0 0], -k);
22.
xlabel(tiempo (Trimestres));
23.
ylabel(Variacion Porcentual Trimestral);
24.
legend(\Delta_4%PBI real);
25.
grid on;
26.
27.
28.
29.
Ejecucin:
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
xlabel(tiempo (Trimestres));
ylabel(Billones de US$ del 2000);
legend(PBI real, PBI potencial (Tendencia));
grid on;
T = 1000;
t = (1:T);
% Semilla
rng(123);
% Valores centrales
xc = (-4:0.5:4);
% Vector aleatorio y~N(0,1)
x = randn(T,1);
% Grafica del vector y
subplot(2,1,1);
plot(t,x);
title(Secuencia Gaussiana: y_t ~N(0,1));
xlabel(tiempo);
ylabel(y_t);
grid on;
% Grafica de Histograma
subplot(2,1,2);
hist(x,xc);
title(Histograma de y_t);
xlabel(y_t);
grid on;
>> grafica2d13
Ejecucin:
>> grafica2d14
PBI real
PBI potencial (Tendencia)
10000
5000
yt
15000
0
1940
1950
1960
1970
1980
tiempo (Trimestres)
1990
2000
0
-2
2010
-4
100
200
300
400
-4
-3
-2
-1
400
Ciclo del PBI real
500
600
tiempo
Histograma de y t
700
800
900
1000
200
200
150
0
100
-200
50
-400
1940
1950
1960
1970
1980
tiempo (Trimestres)
1990
2000
0
-5
2010
0
yt
15
4%PBI real
15. Modicar el script anterior de manera que el color de las barras sea azul
y el de los bordes sea blanco.
10
grafica2d15.m (script)
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
0
-5
1940
1950
1960
1970
1980
tiempo (Trimestres)
1990
2000
2010
N (0; 1)
clc; clear;
% Talla de la muestra
T = 1000;
t = (1:T);
% Semilla
rng(123);
% Valores centrales
xc = (-4:0.5:4);
% Vector aleatorio y~N(0,1)
x = randn(T,1);
% Grafica del vector y
subplot(2,1,1);
plot(t,x);
title(Secuencia Gaussiana: y_t ~N(0,1));
xlabel(tiempo);
mataurimaa@uni.pe
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
30.
31.
32.
33.
34.
ylabel(y_t);
grid on;
% Grafica de Histograma
subplot(2,1,2);
hist(x,xc);
h = findobj(gca,Type,patch);
set(h, FaceColor, b, ...
EdgeColor, w);
title(Histograma de y_t);
xlabel(y_t);
grid on;
% Superponemos la Grafica de los puntos centrales
hold on;
plot(xc,zeros(size(xc)), .r);
hold off;
grid on;
% Superponemos la Grafica de los puntos centrales
hold on;
plot(xc,zeros(size(xc)), .r);
hold off;
Ejecucin:
>> grafica2d16
yt
Ejecucin:
-2
>> grafica2d15
-4
100
200
300
400
500
600
tiempo
Histograma de y t
-4
-3
-2
-1
700
800
900
1000
150
2
yt
200
100
50
-2
-4
0
-5
0
100
200
300
400
500
600
tiempo
Histograma de y t
700
800
900
1000
0
yt
17. Modicar el script anterior de manera que se graque el histograma considerando el intervalo de variacin de x dividido en 20 subintervalos.
200
150
grafica2d17.m (script)
100
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
50
0
-5
-4
-3
-2
-1
0
yt
clc; clear;
% Talla de la muestra
T = 1000;
t = (1:T);
% Semilla
rng(123);
% Valores centrales
xc = (-4:0.5:4);
% Vector aleatorio y~N(0,1)
x = randn(T,1);
% Grafica del vector y
subplot(2,1,1);
plot(t,x);
title(Secuencia Gaussiana: y_t ~N(0,1));
xlabel(tiempo);
ylabel(y_t);
grid on;
clc; clear;
% Talla de la muestra
T = 1000;
t = (1:T);
% Semilla
rng(123);
% Vector aleatorio y~N(0,1)
x = randn(T,1);
% Grafica del vector y
subplot(2,1,1);
plot(t,x);
title(Secuencia Gaussiana: y_t ~N(0,1));
xlabel(tiempo);
ylabel(y_t);
grid on;
% Grafica de Histograma
subplot(2,1,2);
nsub = 10;
hist(x, nsub);
title(Histograma de y_t);
xlabel(y_t);
grid on;
% Grafica de Histograma
subplot(2,1,2);
[n, xout] = hist(x,xc);
bar(xout,n);
title(Histograma de y_t);
xlabel(y_t);
mataurimaa@uni.pe
Ejecucin:
>> grafica2d17
grafica2d19.m (script)
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
yt
2
0
-2
-4
100
200
300
400
500
600
tiempo
Histograma de y t
700
800
900
1000
300
200
100
0
-4
-3
-2
-1
0
yt
clc; clear;
load carsmall;
subplot(2,2,1);
boxplot( MPG, Origin);
xlabel(Pais de Origen);
ylabel(Numero de Millas);
subplot(2,2,2);
boxplot( Acceleration, Model_Year+1900);
xlabel(Anio de Fabricacion);
ylabel(Aceleracion);
subplot(2,2,3);
boxplot( MPG, Cylinders);
xlabel(Numero de Cilindros);
ylabel(Numero de Millas);
subplot(2,2,4);
boxplot( Horsepower, Cylinders);
xlabel(Numero de Cilindros);
ylabel(Caballos de Potencia);
clc; clear;
>> grafica2d19
T = 100;
rng(12345);
25
xA = randn(T,1);
xB = randn(T,1);
X = [xA xB];
boxplot( X, {Serie A, Serie B} );
xlabel(Series);
ylabel(Valores);
Aceleracin
40
Nmero de Millas
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
30
20
20
15
10
10
USA
France
Japan
Germany Sweden
Italy
1970
Pais de Origen
Ejecucin:
>> grafica2d18
30
20
10
6
Nmero de Cilindros
150
100
50
2.5
1982
200
Caballos de Potencia
Nmero de Millas
40
1976
Ao de Fabricacin
6
Nmero de Cilindros
2
1.5
Valores
1
0.5
0
-0.5
-1
-1.5
-2
-2.5
Serie A
Serie B
Series
19. Cargar la base de datos carsmall (que trae MATLAB por defecto) y gracar
El boxplot de numero de millas agrupado por paises.
El boxplot de aceleracion agrupado por ao de fabricacin
El boxplot de numero de millas agrupado por numero de cilindros.
EXPOSITOR: Miguel Ataurima Arellano
mataurimaa@uni.pe
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
bp
Oferta : q = cp
donde a; b y c son parmetros. Considere el caso a = 25, b = 2;5 y c = 2.
Personalice la visualizacin para valores en el eje horizontal que varen entre 0
y 25 y valores en el eje vertical que varen entre 0 y 15. Haga uso de funciones
annimas para la especicacin de las funciones de oferta y demanda.
grafica2d20.m (script)
xlabel(q: Cantidad);
ylabel(u.m./producto);
axis([0 25 0 15]);
clc; clear;
Ejecucin:
% Precios
p = (0:25);
>> grafica2d21
% Demanda de Mercado
a = 25;
b = 2.5;
q_d = @(p) a - b*p;
15
% Oferta de Mercado
c = 2;
q_s = @(q) c*p;
10
u.m./producto
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
% Grafica
plot(q_d(p), p, ...
q_s(p), p, ...
[qstar qstar], [0 pstar], .:k, ...
[0 qstar], [pstar pstar], .:k);
% Grafica
plot(q_d(p), p, ...
q_s(p), p);
xlabel(q: Cantidad);
ylabel(u.m./producto);
axis([0 25 0 15]);
10
15
q: Cantidad
20
25
>> grafica2d20
c(q) = cf + x1 q + x2 q 2 + x3 q 3
donde x1 , x2 , x3 son parmetros que se denen considerando como dados
el costo jo cf , el costo total c0 y marginal m en el punto de inexin q0
de la curva de costos.
15
10
10
15
q: Cantidad
20
25
p (q) = a
grafica2d21.m (script)
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
17.
18.
bq
clc; clear;
% Precios
p = (0:25);
2bq
c (q)
cm (q)
% Oferta
c = 2;
q_s = @(q) c*p;
La cantidad qc en la que
cvme(qc ) = cm(qc )
% Equilibrio
pstar = a/(b+c);
qstar = a-b*pstar;
mataurimaa@uni.pe
074.
075.
076.
077.
078.
079.
080.
081.
082.
083.
084.
085.
086.
087.
088.
089.
090.
091.
092.
093.
094.
095.
096.
097.
098.
099.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
clc; clear;
%% PARAMETROS
% Parametros de la curva de costos c(q)
% c(q) = cf + x(1).q + x(2).q^2 + x(3).q^3
cf = 40;
m = 1;
c0 = 50;
q0 = 5;
%
%
a
b
subplot(2,3,4);
plot(q, cm(q), ...
q, cme(q), ...
q, cvme(q), ...
q, cfme(q), ...
[qc qc], [0 cm(qc)],
[q0 q0], [0 cm(q0)],
[q1 q1], [0 cm(q1)],
xlabel(q: Cantidad);
ylabel(u.m./producto);
legend(cm(q), cme(q),
axis([0 25 0 15]);
:.b, ...
:.k, ...
:.k);
cvme(q), cfme(q));
subplot(2,3,2);
plot(q, c(q), ...
q, it(q), ...
[qstar qstar], [0 c(qstar)], .:k, ...
[qstar qstar], [c(qstar) it(qstar)], .-k, ...
[qstar qstar], [0 c(qstar)], .:k, ...
[qb(1) qb(1)], [0 c(qb(1))], .:k, ...
[qb(2) qb(2)], [0 c(qb(2))], .:k, ...
[qc qc qc], [0 c(qc) it(qc)], .:b);
xlabel(q: Cantidad);
ylabel(u.m.);
legend(c(q), it(q), \pi(q)^*);
axis([0 25 0 200]);
subplot(2,3,5);
plot(qcm, cm(qcm), ...
q, cme(q), ...
q, p(q), r, ...
q, im(q) , :r, ...
[qc qc], [0 cm(qc)], :.b, ...
[qstar qstar], [0 cm(qstar)], .:k, ...
[qstar qstar], [0 p(qstar)], .:k, ...
[0 qstar], [cm(qstar) cm(qstar)], .:k, ...
[0 qstar], [p(qstar) p(qstar)], .:k );
xlabel(q: Cantidad);
ylabel(u.m./producto);
axis([0 25 0 15]);
legend(cm(q), cme(q), p(q), im(q));
subplot(2,3,3);
plot(q, beneficio(q), ...
[qstar qstar], [0 beneficio(qstar)], .-k, ...
[qc qc], [0 beneficio(qc)], .:b, ...
[qb(1) qb(2)], [0 0], .k, ...
[0 q(end)], [0 0], -k);
xlabel(q: Cantidad);
ylabel(u.m.);
legend(\pi(q), \pi(q)^*);
axis([0 25 -50 150]);
subplot(2,3,6);
plot(q, beneficiom(q), ...
[qc qc], [0 beneficiom(qc)], .:b, ...
qstar, 0, .k, ...
[qb(1) qb(1)], [0 beneficiom(qb(1))], .:k, ...
[qb(2) qb(2)], [0 beneficiom(qb(2))], .:k, ...
[0 q(end)], [0 0], -k);
xlabel(q: Cantidad);
ylabel(u.m./producto);
legend(\pi(q));
axis([0 25 -20 20]);
Ejecucin:
%% GRAFICAS
subplot(2,3,1);
plot(q, c(q), ...
>> grafica2d22
10
mataurimaa@uni.pe
u.m.
u.m./producto
10
15
q: Cantidad
20
25
11
10
15
10
15
q: Cantidad
20
25
cm(q)
cme(q)
cvme(q)
cfme(q)
10
15
50
100
150
200
50
100
150
c(q)
cv(q)
cf
u.m.
u.m./producto
(q)*
c(q)
it(q)
10
15
q: Cantidad
10
15
q: Cantidad
20
20
25
cm(q)
cme(q)
p(q)
im(q)
25
u.m.
u.m./producto
200
-20
-15
-10
-5
10
15
20
-50
50
100
150
(q)*
(q)
10
15
q: Cantidad
10
15
q: Cantidad
20
20
'(q)
25
25
mataurimaa@uni.pe
23. Modique el script anterior de manera que la grca de los valores de las
variables asociados a niveles de produccin por debajo del nivel de punto de
cierre (qc ) se visualicen con guiones y de color gris.
075.
076.
077.
078.
079.
080.
081.
082.
083.
084.
085.
086.
087.
088.
089.
090.
091.
092.
093.
094.
095.
096.
097.
098.
099.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
grafica2d23.m (script)
001.
002.
003.
004.
005.
006.
007.
008.
009.
010.
011.
012.
013.
014.
015.
016.
017.
018.
019.
020.
021.
022.
023.
024.
025.
026.
027.
028.
029.
030.
031.
032.
033.
034.
035.
036.
037.
038.
039.
040.
041.
042.
043.
044.
045.
046.
047.
048.
049.
050.
051.
052.
053.
054.
055.
056.
057.
058.
059.
060.
061.
062.
063.
064.
065.
066.
067.
068.
069.
070.
071.
072.
073.
074.
clc; clear;
%% PARAMETROS
% Parametros de la curva de costos c(q)
% c(q) = cf + x(1).q + x(2).q^2 + x(3).q^3
cf = 40;
m = 1;
c0 = 50;
q0 = 5;
%
%
a
b
12
mataurimaa@uni.pe
u.m.
u.m./producto
10
15
q: Cantidad
20
25
13
10
15
10
15
q: Cantidad
20
cm(q)
cme(q)
cvme(q)
cfme(q)
25
10
15
50
100
150
200
50
100
150
c(q)
cv(q)
cf
u.m.
u.m./producto
10
15
q: Cantidad
10
15
q: Cantidad
20
cm(q)
cme(q)
p(q)
im(q)
20
(q)*
c(q)
it(q)
25
25
u.m.
u.m./producto
200
-20
-15
-10
-5
10
15
20
-50
50
100
150
10
15
q: Cantidad
10
15
q: Cantidad
20
20
'(q)
(q)*
(q)
25
25
154. legend(\pi(q));
155. axis([0 25 -20 20]);
Ejecucin:
>> grafica2d23
mataurimaa@uni.pe
24.
14
mataurimaa@uni.pe