function [F, C, V, D, W, signoX, signoXF] = ej(ejemplo, presentacion, par1, par2, par3, par4, par5)
if nargin < 1, ejemplo = []; end
if isempty(ejemplo), ejemplo = 0; end
if nargin < 2, presentacion = []; end
if isempty(presentacion), presentacion = 1; end
if nargin < 3, par1 = []; end
if nargin < 4, par2 = []; end
if nargin < 5, par3 = []; end
if nargin < 6, par4 = []; end
if nargin < 7, par5 = []; end
C = []; V = []; D = []; W = []; B = []; A = []; F = []; signoX = []; signoXF = [];
switch ejemplo
case 0
help ej
case {1, '1.1', '2.5'}
if presentacion, disp('�2.5 VN Primer ejemplo de VN'); end
C = [70, 12;
30, 8;
70, 12];
V = [210, 0;
90, 0;
210, 0];
B = [575, 0;
0, 20;
400, 0];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {2, '3.5'}
if presentacion, disp('�3.5 TE Primer ejemplo de TE'); end
[G, C, V, B] = ej('1.1', 0);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {3, '4.1'}
if presentacion, disp('�4.1 TE Cantidades de trabajo necesario'); end
C = [0 , 0, 0;
4 , 0, 0;
10, 5, 0];
L = [0.05;
0.1 ;
7 ];
R = [1, 2, 0.01];
V = L * R;
B = eye(3,3);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {4, '4.2'}
if presentacion, disp('�4.2 TE Tipos de trabajo'); end
C = [70, 12;
30, 8;
70, 12];
B = [575, 0;
0, 20;
400, 0];
L1 = [1;
2;
3];
R1 = [5, 1];
L2 = [4;
5;
6];
R2 = [1, 1];
L3 = [1;
0;
1];
R3 = [2, 1];
V = L1*R1 + L2*R2 + L3*R3;
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {5, '4.3'}
if presentacion, disp('�4.3 VN Productivo e improductivo'); end
C = [ 70, 12, 0;
30, 8, 0;
0.25, 1, 0];
V = [210, 0, 0;
90, 0, 0;
0.75, 0, 0];
B = [575, 0, 0;
0, 20, 0;
0, 0, 1];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {6, '4.4'}
if presentacion, disp('�4.4 VN Materias "escasas"'); end
C = [70, 12, 1;
30, 8, 0;
70, 12, 1;
1, 1, 0];
V = [210, 0, 0;
90, 0, 0;
210, 0, 0;
1, 0, 0];
B = [575, 0, 1;
0, 20, 0;
400, 0, 1;
0, 0, 1];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {7, '4.4b'}
if presentacion, disp('�4.4b VN Materias "escasas" sin el cuarto proceso'); end
F = ej('4.4', 0);
F(4,:,:) = [];
case {8, '4.4c'}
if presentacion, disp('�4.4c VN Materias "escasas" sin los procesos tercero y cuarto'); end
F = ej('4.4', 0);
F(3:4,:,:) = [];
case {9, '4.4d'}
if presentacion, disp('�4.4d TE Materias "escasas" sin el cuarto proceso'); end
[G, C, V, B] = ej('4.4', 0);
F(:,:,1) = -V(1:3,:);
F(:,:,2) = B(1:3,:) - C(1:3,:);
case {10, '4.5'}
if presentacion, disp('�4.5 VN Valores negativos'); end
C = [ 70, 12, 0;
30, 8, 0;
0, 1, 1];
V = [210, 0, 0;
90, 0, 0;
1, 0, 0];
B = [575, 0, 1;
0, 20, 1;
0, 0, 0];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {11, '4.5b'}
if presentacion, disp('�4.5b VN Con el proceso de eliminaci�n gratuita'); end
C = [ 70, 12, 0;
30, 8, 0;
0, 1, 1;
0, 0, 1];
V = [210, 0, 0;
90, 0, 0;
1, 0, 0;
0, 0, 0];
B = [575, 0, 1;
0, 20, 1;
0, 0, 0;
0, 0, 0];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {12, '4.5c'}
if presentacion, disp('�4.5c TE Valores negativos'); end
[G, C, V, B] = ej('4.5', 0);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {13, '4.5d'}
if presentacion, disp('�4.5d TE Con el proceso de eliminaci�n gratuita'); end
[G, C, V, B] = ej('4.5b', 0);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case '4.6'
if presentacion, disp('�4.6 VN Tasas de beneficio'); end
F(:,:,1) = -1;
F(:,:,2) = 2.4;
F(:,:,3) = -1.43;
case {14, '5.1'}
if presentacion, disp('�5.1 VN Espacio'); end
C = [ 70 , 12, 0 , 0;
0 , 0, 30 , 8;
1 , 0, 0 , 0;
0 , 0, 0 , 1];
V = [210 , 0, 0 , 0;
0 , 0, 90 , 0;
0.01, 0, 0 , 0;
0 , 0, 0.01, 0];
B = [575 , 0, 0 , 0;
0 , 0, 0 , 20;
0 , 0, 1 , 0;
0 , 1, 0 , 0];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {15, '5.1b'}
if presentacion, disp('�5.1b TE Espacio'); end
[G, C, V, B] = ej('5.1', 0);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {16, '6.1'}
if presentacion, disp('�6.1 VN Depreciaci�n con eficiencia constante (edades = par1)'); end
if isempty(par1), edades = 50; else edades = par1; end
if isempty(par2), ci = 2; else ci = par2; end
if isempty(par3), vi = 4; else vi = par3; end
if isempty(par4), bi = 7; else bi = par4; end
c0 = 0.5;
v0 = 0.3;
b0 = 0;
C = [[c0; ci*ones(edades,1)] , [zeros(1,edades); eye(edades)]];
V = [[v0; vi*ones(edades,1)] , [zeros(1,edades); zeros(edades)]];
B = [[b0; bi*ones(edades,1)] , [eye(edades); zeros(1,edades)]];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {17, '6.1b'}
if presentacion, disp('�6.1b TE Desvalorizaci�n con eficiencia constante (edades = par1)'); end
[G, C, V, B] = ej('6.1', 0, par1, par2, par3, par4);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {18, '6.1c'}
if presentacion, disp('�6.1c TE M�todo de edades'); end
C = [0.5, 0, 0, 0;
2, 1, 0, 0;
2, 0, 1, 0;
2, 0, 0, 1];
V = [0.3, 0, 0, 0;
4, 0, 0, 0;
4, 0, 0, 0;
4, 0, 0, 0];
B = [0, 1, 0, 0;
7, 0, 1, 0;
7, 0, 0, 1;
7, 0, 0, 0];
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {19, '6.1d'}
if presentacion, disp('�6.1d TE M�todo de la carga de desvalorizaci�n'); end
C = [0.5, 0 ;
2 , 1/3];
V = [0.3, 0 ;
4 , 0 ];
B = [0 , 1 ;
7 , 0 ];
F(:,:,1) = -V;
F(:,:,2) = B - C;
case '6.1e'
if presentacion, disp('�6.1e VN M�todo de edades'); end
[G, C, V, B] = ej('6.1c', 0);
F(:,:,1) = -C - V;
F(:,:,2) = B;
case '6.1f'
if presentacion, disp('�6.1f VN M�todo de la carga de depreciaci�n'); end
F = inline('[-0.5-0.3, 1/k ; -6 + 7/k, -(k^3-k^(3-1))/(k^3-1)]');
case {20, '6.4'}
if presentacion, disp('�6.4 TE Materia de vida c�clica'); end
C = [ 2, 1, 0, 0;
2, 0, 1, 0;
2, 0, 0, 1];
V = [ 2, 0, 0, 0;
2, 0, 0, 0;
2, 0, 0, 0];
B = [ 0, 0, 1, 0;
0, 0, 0, 1;
20, 1, 0, 0];
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {21, '6.4b'}
if presentacion, disp('�6.4b VN Materia de vida c�clica'); end
C = [ 2, 1, 0, 0;
2, 0, 1, 0;
2, 0, 0, 1;
3, 0, 0, 0];
V = [ 2, 0, 0, 0;
2, 0, 0, 0;
2, 0, 0, 0;
4, 0, 0, 0];
B = [ 0, 0, 1, 0;
0, 0, 0, 1;
20, 1, 0, 0;
0, 0, 1, 0];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {22, '7.1'}
if presentacion, disp('�7.1 VN Problema de los conejos de Fibonacci'); end
A = [1, 0;
0, 1];
B = [0, 1;
1, 1];
F(:,:,1) = -A;
F(:,:,2) = B;
case {23, '7.1b'}
if presentacion, disp('�7.1b VN Demograf�a'); end
Sr = [0.967, 0.997, 0.998, 0.998, 0.997, 0.995, 0.995, 0.992, 0.989, 0.983, 0.976, 0.939, 0.968, 0.905, 0.835, 0.683, 0.507];
br = [0, 0, 0, 0.025, 0.250, 0.485, 0.373, 0.200, 0.073, 0.005, 0, 0, 0, 0, 0, 0, 0, 0];
A = eye(18,18);
D = diag(Sr, 1);
W = zeros(18,18);
W(:, 1) = br';
F(:,:,1) = -A;
F(:,:,2) = D + W;
case {24, '7.1c'}
if presentacion, disp('�7.1c VN Demograf�a con br/1.34659988411590'); end
[G, A, V, D, W] = ej('7.1b', 0);
W = W ./ 1.34659988411590;
F(:,:,1) = -A;
F(:,:,2) = D + W;
case {25, '7.1d'}
if presentacion, disp('�7.1d VN Demograf�a con br/2'); end
[G, A, V, D, W] = ej('7.1b', 0);
W = W ./ 2;
F(:,:,1) = -A;
F(:,:,2) = D + W;
case {26, '7.3'}
if presentacion, disp('�7.3 VN Colmena'); end
C = eye(9,9);
C(9, 8) = 1;
C(9, 9) = 0;
V = zeros(9,9);
V(:, 9) = [1,1,1,9,9,9,9,1,9]';
B = zeros(9,9);
B(1:7, 1:7) = diag([.5,.5,0,.9,.9,.9], 1);
B(4:7, 8) = 500;
B(1:3, 9) = 2;
B(8, 1) = 1;
B(9, 4) = 1;
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {27, '8.1'}
if presentacion, disp('�8.1 VN Procesos duraderos con un paso temporal'); end
C = [ 70, 0, 0,0,0,0,0,0;
30, 0, 0,0,0,0,0,0;
70, 0, 0,0,0,0,0,0;
0, 12, 1,0,0,0,0,0;
0, 0, 0,1,0,0,0,0;
0, 0, 0,0,1,0,0,0;
0, 0, 0,0,0,1,0,0;
0, 8, 0,0,0,0,1,0;
0, 12, 0,0,0,0,0,1];
V = [210, 0, 0,0,0,0,0,0;
90, 0, 0,0,0,0,0,0;
210, 0, 0,0,0,0,0,0;
0, 0, 0,0,0,0,0,0;
0, 0, 0,0,0,0,0,0;
0, 0, 0,0,0,0,0,0;
0, 0, 0,0,0,0,0,0;
0, 0, 0,0,0,0,0,0;
0, 0, 0,0,0,0,0,0];
B = [ 0, 0, 1,0,0,0,0,0;
0, 15, 0,1,0,0,0,0;
400, 0, 0,0,1,0,0,0;
575, 0, 0,0,0,1,0,0;
0, 0, 0,0,0,0,1,0;
0, 0, 0,0,0,0,0,1;
0, 0, 0,0,0,0,0,0;
0, 5, 0,0,0,0,0,0;
0, 0, 0,0,0,0,0,0];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {28, '8.1b'}
if presentacion, disp('�8.1b VN Procesos duraderos con los procesos que se inician'); end
a0 = [280, 0;
120, 0;
280, 0];
b0 = [ 0, 0;
0, 15;
400, 0];
a1 = [ 0, 12;
0, 0;
0, 0];
b1 = [575, 0;
0, 0;
0, 0];
a2 = [ 0, 0;
0, 8;
0, 12];
b2 = [ 0, 0;
0, 5;
0, 0];
F(:,:,1) = -a0;
F(:,:,2) = b0-a1;
F(:,:,3) = b1-a2;
F(:,:,4) = b2;
case {29, '8.1c'}
if presentacion, disp('�8.1c TE Procesos duraderos con un paso temporal'); end
[G, C, V, B] = ej('8.1', 0);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {30, '8.2'}
if presentacion, disp('�8.2 VN Procesos duraderos con varios pasos temporales'); end
F(:,:,1) = [-280, 0;
-120, 0;
-280, 0];
F(:,:,2) = [ 0, -12;
0, 15;
400, 0];
F(:,:,3) = [ 575, 0;
0, -8;
0, -12];
F(:,:,4) = [ 0, 0;
0, 5;
0, 0];
case {31, '8.3'}
if presentacion, disp('�8.3 VN Tiempo continuo'); end
F = inline('[(pi^0.5)*exp((log(k)^2)/4)*(erf(log(k)/2)-1)/2 + 1/(log(k)+1)]', 'k');
case {32, '9.3'}
if presentacion, disp('�9.3 VN Funciones de producci�n con aproximaci�n poligonal'); end
[F, T] = formapoligonal('ejemplo3', 10000, 0, 20);
C = T;
case {33, '10.4'}
if presentacion, disp('�10.4 VNC Poblaci�n con ciclo anual'); end
A = eye(8,8);
B0 = diag(ones(1,7).*0.9, 1);
B0(3:8,1) = 1;
B = diag(ones(1,7).*0.9, 1);
Z = zeros(8,8);
F(:,:,1) = [-A,B0, Z, Z;
Z,-A, B, Z;
Z, Z,-A, B;
Z, Z, Z,-A];
F(:,:,2) = [ Z, Z, Z, Z;
Z, Z, Z, Z;
Z, Z, Z, Z;
B, Z, Z, Z];
case {34, '10.4b'}
if presentacion, disp('�10.4b VNC Matriz c�clica, p = 1'); end
A = eye(3);
B = [0,2,0;
0,0,2;
2,0,0];
F(:,:,1) = -A;
F(:,:,2) = B;
case {35, '10.4c'}
if presentacion, disp('�10.4c VNC Matriz c�clica, p = 2'); end
F = formaciclos(ej('10.4b', 0), 2);
case {36, '10.4d'}
if presentacion, disp('�10.4d VNC Matriz c�clica, p = 3'); end
F = formaciclos(ej('10.4b', 0), 3);
case {37, '10.4e'}
if presentacion, disp('�10.4e VNC Matriz c�clica, p = 4'); end
F = formaciclos(ej('10.4b', 0), 4);
case {38, '10.4f'}
if presentacion, disp('�10.4f VNC Matriz c�clica (p = par1)'); end
if isempty(par1), par1 = 1; end
F = formaciclos(ej('10.4b', 0), par1);
case {39, '12.2'}
if presentacion, disp('�12.2 VN Intercambios con el primer proceso'); end
G = ej('1.1', 0);
F = formaprecios(G(1,:,:), [1/2624; 15/2624]);
case {40, '12.2b'}
if presentacion, disp('�12.2b VN Intercambios con el segundo proceso'); end
G = ej('1.1', 0);
F = formaprecios(G(2,:,:), [1/2624; 15/2624]);
case {41, '12.2c'}
if presentacion, disp('�12.2c VN Intercambios con el tercer proceso'); end
G = ej('1.1', 0);
F = formaprecios(G(3,:,:), [1/2624; 15/2624]);
case {42, '12.2d'}
if presentacion, disp('�12.2d VN Intercambios con precios [1;12], primer proceso'); end
G = ej('1.1', 0);
F = formaprecios(G(1,:,:), [1; 12]);
case {43, '12.2e'}
if presentacion, disp('�12.2e VN Intercambios con precios [1;12], segundo proceso'); end
G = ej('1.1', 0);
F = formaprecios(G(2,:,:), [1; 12]);
case {44, '13.3'}
if presentacion, disp('�13.3 VN Flujos impuestos'); end
[G, C, V, B] = ej('4.3', 0);
Y = [1; 15; 20];
P = -(C+V) * Y;
Q = [-0.1, 0, -0.005];
S = P * Q;
F(:,:,1) = -C - V - S;
F(:,:,2) = B;
W = S;
case {45, '13.3b'}
if presentacion, disp('�13.3b TE Flujos impuestos'); end
[G, C, V, B] = ej('4.3', 0);
Y = [1; 14.375; 15.8125];
P = -V * Y;
Q = [-0.1, 0, -0.005];
S = P * Q;
F(:,:,1) = -V;
F(:,:,2) = B - C - S;
W = S;
case {46, '13.3c'}
if presentacion, disp('�13.3c VN Flujos impuestos con precios [1,15,2]'); end
[G, C, V, B] = ej('4.3', 0);
Y = [1; 15; 2];
P = -(C+V) * Y;
Q = [-0.1, 0, -0.005];
S = P * Q;
F(:,:,1) = -C - V - S;
F(:,:,2) = B;
W = S;
case {47, '13.3d'}
[G, C, V, B] = ej('6.1', 0);
if presentacion, disp('�13.3d VN Imposici�n prefijada desde ej(16) (imposici�n = par1)'); end
if isempty(par1), imposicion = 1; else imposicion = par1; end
Y = [0.18649241857403
0.17076393530727
0.17073504489560
0.17070197759704
0.17066412953010
0.17062080950599
0.17057122640598
0.17051447473380
0.17044951807932
0.17037517019142
0.17029007331446
0.17019267339262
0.17008119168952
0.16995359230450
0.16980754499267
0.16964038260946
0.16944905240279
0.16923006026303
0.16897940691292
0.16869251487202
0.16836414486182
0.16798830012502
0.16755811691160
0.16706573913166
0.16650217488596
0.16585713225414
0.16511883134162
0.16427378915285
0.16330657336227
0.16219952048611
0.16093241330844
0.15948211167037
0.15782212988001
0.15592215302554
0.15374748335838
0.15125840663614
0.14840946685335
0.14514863611501
0.14141636449301
0.13714449251370
0.13225500641627
0.12665861345018
0.12025311119356
0.11292152111256
0.10452995227651
0.09492515621562
0.08393172826743
0.07134890430263
0.05694689433127
0.04046268603310
0.02159524157514];
P = -(C + V)*Y;
Q = [-1, zeros(1,50)];
S = imposicion .* P * Q;
F(:,:,1) = -C - V - S;
F(:,:,2) = B;
case {48, '13.4'}
if presentacion, disp('�13.4 VN Colmena con extracci�n de miel (miel retirada = par1)'); end
if isempty(par1), mielretirada = 0; else mielretirada = par1; end
G = ej('7.3', 0);
Q = [0,0,0,0,0,0,0,0,-mielretirada];
P = -ones(9, 1);
S = P * Q;
A = -G(:,:,1);
B = G(:,:,2);
F(:,:,1) = -A - S;
F(:,:,2) = B;
case {49, '14.1'}
if presentacion, disp('�14.1 VN Soluci�n m�ltiple'); end
A = [280, 12, 0, 0;
120, 8, 0, 0;
0, 0, 280, 12;
0, 0, 120, 8];
B = [575, 0, 0, 0;
0, 20, 0, 0;
0, 0, 450, 0;
0, 0, 0, 20];
F(:,:,1) = -A;
F(:,:,2) = B;
case {50, '15.1'}
if presentacion, disp('�15.1 VN Perturbaci�n h = 0'); end
F = ej('1.1', 0);
F(3,:,:) = [];
case {51, '15.1b'}
if presentacion, disp('�15.1b VN Perturbaci�n h = 0.01'); end
F = ej('1.1', 0);
F(3,:,:) = [];
F(1,1,2) = F(1,1,2) + 0.01;
case {52, '15.1c'}
if presentacion, disp('�15.1c VN Perturbaci�n h = 0.1'); end
F = ej('1.1', 0);
F(3,:,:) = [];
F(1,1,2) = F(1,1,2) + 0.1;
case {53, '15.1d'}
if presentacion, disp('�15.1d VN Perturbaci�n h = 1'); end
F = ej('1.1', 0);
F(3,:,:) = [];
F(1,1,2) = F(1,1,2) + 1;
case {54, '15.1e'}
if presentacion, disp('�15.1e VN Perturbaci�n h = 10'); end
F = ej('1.1', 0);
F(3,:,:) = [];
F(1,1,2) = F(1,1,2) + 10;
case {55, '15.1f'}
if presentacion, disp('�15.1f VN Perturbaci�n h = 100'); end
F = ej('1.1', 0);
F(3,:,:) = [];
F(1,1,2) = F(1,1,2) + 100;
case {56, '15.1g'}
if presentacion, disp('�15.1g VN Perturbaci�n (h = par1)'); end
if isempty(par1), h = 0; else h = par1; end
F = ej('1.1', 0);
F(3,:,:) = [];
F(1,1,2) = F(1,1,2) + h;
case {57, '15.2'}
if presentacion, disp('�15.2 VN Soluci�n m�ltiple'); end
A = [1, 0;
0, 1];
B = [3, 0;
0, 2];
F(:,:,1) = -A;
F(:,:,2) = B;
case {58, '15.2b'}
if presentacion, disp('�15.2b VN Antigua soluci�n m�ltiple con proceso a�adido'); end
A = [1, 0;
0, 1;
0, 0];
B = [3, 0;
0, 2;
1, 0];
F(:,:,1) = -A;
F(:,:,2) = B;
case {59, '19.2'}
if presentacion, disp('�19.2 VN Econom�a rob�tica'); end
[G, C, V, B] = ej('1.1', 0);
V = V.*0;
F(:,:,1) = -C;
F(:,:,2) = B;
case {60, '19.2b'}
if presentacion, disp('�19.2b VN Econom�a rob�tica incluyendo los procesos con trabajo'); end
[G, C, V, B] = ej('1.1', 0);
C = [C; C];
V = [V.*0; V];
B = [B; B];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case '19.2c'
if presentacion, disp('�19.2c TE Econom�a rob�tica'); end
[G, C, V, B] = ej('19.2b', 0);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {61, '21.5'}
if presentacion, disp('�21.5 VN Ecosistema (forma can�nica)'); end
if isempty(par1), par1 = 4; end
if isempty(par2), par2 = 3; end
if isempty(par3), par3 = 2; end
if isempty(par4), par4 = 1; end
if isempty(par5), par5 = 1; end
A = [1 , 0 , 0 ;
par4, 1 , 0 ;
0 , par5, 1 ];
B = [par1, 0 , 0 ;
0 , par2, 0 ;
0 , 0 , par3];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case {62, '21.5b'}
if presentacion, disp('�21.5c VN Ecosistema complejo con edades'); end
n1 = 5; R1 = [0;0;0;4;4]; S1 = [1,1,1,1].*0.9;
n2 = 3; R2 = [0;1;1]; S2 = [1,1].*0.7;
n3 = 4; R3 = [0;0;1;0.5]; S3 = [1,1,1].*0.7;
n4 = 6; R4 = [0;0;0;1;1;1]; S4 = [1,1,1,1,1].*0.8;
I1 = eye(n1);
L1 = diag(S1, 1);
L1(:, 1) = R1;
I2 = eye(n2);
A2 = ones(n2, n1);
L2 = diag(S2, 1);
L2(:, 1) = R2;
I3 = eye(n3);
A3 = ones(n3, n2);
L3 = diag(S3, 1);
L3(:, 1) = R3;
I4 = eye(n4);
A4 = ones(n4, n1);
L4 = diag(S4, 1);
L4(:, 1) = R4;
A = [ I1, zeros(n1,n2), zeros(n1,n3), zeros(n1,n4);
A2, I2, zeros(n2,n3), zeros(n2,n4);
zeros(n3,n1), A3, I3, zeros(n3,n4);
A4, zeros(n4,n2), zeros(n4,n3), I4];
B = [ L1, zeros(n1,n2), zeros(n1,n3), zeros(n1,n4);
zeros(n2,n1), L2, zeros(n2,n3), zeros(n2,n4);
zeros(n3,n1), zeros(n3,n2), L3, zeros(n3,n4);
zeros(n4,n1), zeros(n4,n2), zeros(n4,n3), L4];
F(:,:,1) = -A;
F(:,:,2) = B;
case {63, '23.6'}
if presentacion, disp('�23.6 TE Teor�a de explotaci�n Trigo'); end
[F, C, V, B] = ej('1.1', 0);
A = C + V;
C = [zeros(3,1), A(:, 2)];
V = [A(:, 1), zeros(3,1)];
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {64, '23.6b'}
if presentacion, disp('�23.6b TE Teor�a de explotaci�n Hierro'); end
[F, C, V, B] = ej('1.1', 0);
A = C + V;
C = [A(:, 1), zeros(3,1)];
V = [zeros(3,1), A(:, 2)];
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {65, '23.6c'}
if presentacion, disp('�23.6c TE Teor�a de explotaci�n Miel'); end
C = eye(9,9);
C(9, 8) = 1;
C(9, 9) = 0;
V = zeros(9,9);
V(:, 9) = [1,1,1,9,9,9,9,1,9]';
B = zeros(9,9);
B(1:7, 1:7) = diag([.5,.5,0,.9,.9,.9], 1);
B(4:7, 8) = 500;
B(1:3, 9) = 2;
B(8, 1) = 1;
B(9, 4) = 1;
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {66, '23.6d'}
if presentacion, disp('�23.6d TE Teor�a de la cosecha extrayendo una edad (edad = par1)'); end
if isempty(par1), edad = 1; else edad = par1; end
G = ej('7.1b', 0);
B = G(:,:,2);
C = eye(18,18);
V = zeros(18,18);
V(edad, edad) = 1;
F(:,:,1) = -V;
F(:,:,2)= B - C;
case {67, '23.6e'}
if presentacion, disp('�23.6e TE Teor�a de la cosecha extrayendo todas las edades'); end
G = ej('7.1b', 0);
B = G(:,:,2);
C = eye(18,18);
V = eye(18,18);
F(:,:,1) = -V;
F(:,:,2)= B - C;
case {68, '24.1'}
if presentacion, disp('�24.1 VN Tableau de Quesnay'); end
A = [1, 1, 1;
1, 1, 0];
S = [0, 1, 1;
0, 0, 0];
B = [2, 3, 0;
0, 0, 2];
F(:,:,1) = -A - S;
F(:,:,2) = B;
case {69, '24.2'}
if presentacion, disp('�24.2 VN Esquemas de reproducci�n de Marx (C+V -> B)'); end
C = [4000, 0;
2000, 0];
V = [ 0, 1000;
0, 500];
B = [6000, 0;
0, 3000];
F(:,:,1) = -C - V;
F(:,:,2) = B;
case {70, '24.2b'}
if presentacion, disp('�24.2b TE de Esquemas de reproducci�n de Marx'); end
[F, C, V, B] = ej('24.2', 0);
F(:,:,1) = -V;
F(:,:,2) = B - C;
case {71, '24.2c'}
if presentacion, disp('�24.2c VN Esquemas de reproducci�n de Marx (C+V+S -> B)'); end
[F, C, V, B] = ej('24.2', 0);
S = [ 0, 1000;
0, 500];
F(:,:,1) = -C - V - S;
F(:,:,2) = B;
case 101
if presentacion, disp('VN Thompson, en Kuhn y Tucker [2], p�gina 278 (forma can�nica)'); end
A = [0,0,0,0,1;
0,0,0,1,0;
0,0,1,0,0;
0,1,0,0,0;
1,0,0,0,0];
B = [0,0,0,0,5;
0,0,0,4,0;
0,0,3,0,0;
0,2,0,0,0;
1,0,0,0,0];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 102
if presentacion, disp('VN Thompson, en Kuhn y Tucker [2], p�gina 279 (forma can�nica) (par1,par2)'); end
if isempty(par1), par1 = 1; end
if isempty(par2), par2 = 1; end
A = [0, 1 ;
1, par1];
B = [0, 2 ;
1, par2];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 103
if presentacion, disp('VN Thompson, en Kuhn y Tucker [2], p�gina 279 (forma can�nica)'); end
A = [0, 1;
1, 0];
B = [2, 1;
1, 1];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 104
if presentacion, disp('VN Gale, en Kuhn y Tucker [2], p�gina 296 (forma can�nica)'); end
A = [0,1,0,0;
1,0,0,1;
0,0,1,0];
B = [1,0,0,0;
0,0,2,0;
0,1,0,1];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 105
if presentacion, disp('VN Gale, en Kuhn y Tucker [2], p�gina 297 (forma can�nica)'); end
A = [0,1,0,0,0,0;
1,0,1,0,0,0;
0,0,0,1,0,0;
0,0,1,0,0,1;
0,0,0,0,1,0];
B = [1,0,0,1,0,0;
0,1,0,0,0,0;
0,0,1,0,0,0;
0,0,0,0,2,0;
0,0,0,1,0,1];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 106
if presentacion, disp('VN Gale, en Kuhn y Tucker [2], p�gina 298 (forma can�nica)'); end
A = [0,1,0,0;
1,0,0,0;
0,0,1,0;
0,0,0,1;
0,1,0,0];
B = [2,0,0,0;
0,0,2,0;
0,2,0,0;
0,0,1,0;
0,0,0,1];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 107
if presentacion, disp('VN Morgenstern y Thompson [1], p�gina 24 (forma can�nica)'); end
A = [1,0;
1,4];
B = [1,12;
5,0];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 108
if presentacion, disp('VN Morgenstern y Thompson [1], p�gina 25 (forma can�nica)'); end
A = [0,0;
0,1];
B = [0,1;
1,0];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 109
if presentacion, disp('VN Morgenstern y Thompson [1], p�gina 26 (forma can�nica)'); end
A = [1,0,0;
1,1,0;
1,1,4];
B = [9,0,0
0,1,12;
0,5,0];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
case 110
if presentacion, disp('VN Morgenstern y Thompson [1], p�gina 27 (forma can�nica)'); end
A = [1,0,1;
1,4,1;
4,8,0];
B = [1,12,0;
5,0,0;
0,0,2];
F(:,:,1) = -A;
F(:,:,2) = B;
signoXF = 1;
otherwise
disp('No se ha encontrado un ejemplo. Escribe el comando ej para obtener una ayuda.');
end
if nargout > 1
if isempty(C), C = A; end
if isempty(D), D = B; end
[filas, columnas, ancho] = size(F);
if isempty(signoX), signoX = 1; end
if isempty(signoXF), signoXF = 0; end
if ancho > 1
if size(signoX,2) == 1, signoX = signoX .* ones(1, filas); end
if size(signoXF,2) == 1, signoXF = signoXF .* ones(1, columnas); end
end
end