%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% FILE: esim_rr.m
%%
%% Luvun 1 Reija Reipas esimerkin ratkaisu funktiolla pmatriisi.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Valimukavuusaste
c = 0.8;

%% Palkkiomatriisi
R = [  1    0    0; 
       c    c    0;
     1-c  1-c  1-c];

%% Paatosongelma rakennemuuttujaan po. Vain kentat psaanto ja pmat tarvitaan
po.pmat = R;
po.psaanto = "kk";
pr = pmatriisi(po)

%% Tiedoston ajo ja tuloste GNU Octaven komentorivilla:
%%>> esim_rr
%%pr =
%%
%%  scalar structure containing the fields:
%%
%%    parvot =
%%
%%       0.80000
%%       0.20000
%%       0.80000
%%
%%    poptimi =  2
%%    kmat =
%%
%%       0.00000   0.80000   0.20000
%%       0.20000   0.00000   0.20000
%%       0.80000   0.60000   0.00000     