From: <par...@us...> - 2012-07-02 12:24:41
|
Revision: 10711 http://octave.svn.sourceforge.net/octave/?rev=10711&view=rev Author: paramaniac Date: 2012-07-02 12:24:31 +0000 (Mon, 02 Jul 2012) Log Message: ----------- control-devel: use weaker kalman matrix in pH example Modified Paths: -------------- trunk/octave-forge/extra/control-devel/INDEX trunk/octave-forge/extra/control-devel/inst/@iddata/resample.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/devel/pH2.m Modified: trunk/octave-forge/extra/control-devel/INDEX =================================================================== --- trunk/octave-forge/extra/control-devel/INDEX 2012-07-01 18:50:12 UTC (rev 10710) +++ trunk/octave-forge/extra/control-devel/INDEX 2012-07-02 12:24:31 UTC (rev 10711) @@ -11,6 +11,7 @@ @iddata/merge @iddata/nkshift @iddata/plot + @iddata/resample @iddata/set @iddata/size System Identification Added: trunk/octave-forge/extra/control-devel/devel/pH2.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/pH2.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/pH2.m 2012-07-02 12:24:31 UTC (rev 10711) @@ -0,0 +1,74 @@ +%{ +Contributed by: + Jairo Espinosa + K.U.Leuven ESAT-SISTA + K.Mercierlaan 94 + B3001 Heverlee + Jai...@es... + +Description: + Simulation data of a pH neutralization process in a constant volume + stirring tank. + Volume of the tank 1100 liters + Concentration of the acid solution (HAC) 0.0032 Mol/l + Concentration of the base solution (NaOH) 0,05 Mol/l +Sampling: + 10 sec +Number: + 2001 +Inputs: + u1: Acid solution flow in liters + u2: Base solution flow in liters + +Outputs: + y: pH of the solution in the tank + +References: + T.J. Mc Avoy, E.Hsu and S.Lowenthal, Dynamics of pH in controlled + stirred tank reactor, Ind.Eng.Chem.Process Des.Develop.11(1972) + 71-78 + +Properties: + Highly non-linear system. + +Columns: + Column 1: time-steps + Column 2: input u1 + Column 3: input u2 + Column 4: output y + +Category: + Process industry systems + +%} + +clear all, close all, clc + +load pHdata.dat +U=pHdata(:,2:3); +Y=pHdata(:,4); + + +dat = iddata (Y, U) + +[sys, x0, info] = moen4 (dat, 's', 15, 'n', 6) % s=15, n=6 + +l = lqe (sys, info.Q, 100*info.Ry) + +[a, b, c, d] = ssdata (sys); + +sys = ss ([a-l*c], [b-l*d, l], c, [d, 0], -1) + + +[y, t] = lsim (sys, [U, Y], [], x0); + +err = norm (Y - y, 1) / norm (Y, 1) +st = isstable (sys) + +figure (1) +plot (t, Y(:,1), 'b', t, y(:,1), 'r') +ylim ([0, 15]) +title ('DaISy [96-014]: pH neutralization process in a stirring tank - highly non-linear') +legend ('y measured', 'y simulated', 'location', 'southeast') + + Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/resample.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/resample.m 2012-07-01 18:50:12 UTC (rev 10710) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/resample.m 2012-07-02 12:24:31 UTC (rev 10711) @@ -16,8 +16,8 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{dat} =} diff (@var{dat}) -## @deftypefnx {Function File} {@var{dat} =} diff (@var{dat}, @var{k}) +## @deftypefn {Function File} {@var{dat} =} resample (@var{dat}, @var{p}, @var{q}) +## @deftypefnx {Function File} {@var{dat} =} resample (@var{dat}, @var{p}, @var{q}, @var{n}) ## Return @var{k}-th difference of outputs and inputs of dataset @var{dat}. ## If @var{k} is not specified, default value 1 is taken. ## @end deftypefn @@ -32,6 +32,8 @@ print_usage (); endif + ## requires signal package + h = fir1 (n, 1/q); dat.y = cellfun (@(y) resample (y, p, q, h), dat.y, "uniformoutput", false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |