This list is closed, nobody may subscribe to it.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
(5) |
Sep
(3) |
Oct
(41) |
Nov
(41) |
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(75) |
Feb
(10) |
Mar
(170) |
Apr
(174) |
May
(66) |
Jun
(11) |
Jul
(10) |
Aug
(44) |
Sep
(73) |
Oct
(28) |
Nov
(139) |
Dec
(52) |
2003 |
Jan
(35) |
Feb
(93) |
Mar
(62) |
Apr
(10) |
May
(55) |
Jun
(70) |
Jul
(37) |
Aug
(16) |
Sep
(56) |
Oct
(31) |
Nov
(57) |
Dec
(83) |
2004 |
Jan
(85) |
Feb
(67) |
Mar
(27) |
Apr
(37) |
May
(75) |
Jun
(85) |
Jul
(160) |
Aug
(68) |
Sep
(104) |
Oct
(25) |
Nov
(39) |
Dec
(23) |
2005 |
Jan
(10) |
Feb
(45) |
Mar
(43) |
Apr
(19) |
May
(108) |
Jun
(31) |
Jul
(41) |
Aug
(23) |
Sep
(65) |
Oct
(58) |
Nov
(44) |
Dec
(54) |
2006 |
Jan
(96) |
Feb
(27) |
Mar
(69) |
Apr
(59) |
May
(67) |
Jun
(35) |
Jul
(13) |
Aug
(461) |
Sep
(160) |
Oct
(399) |
Nov
(32) |
Dec
(72) |
2007 |
Jan
(316) |
Feb
(305) |
Mar
(318) |
Apr
(54) |
May
(194) |
Jun
(173) |
Jul
(282) |
Aug
(91) |
Sep
(227) |
Oct
(365) |
Nov
(168) |
Dec
(18) |
2008 |
Jan
(71) |
Feb
(111) |
Mar
(155) |
Apr
(173) |
May
(70) |
Jun
(67) |
Jul
(55) |
Aug
(83) |
Sep
(32) |
Oct
(68) |
Nov
(80) |
Dec
(29) |
2009 |
Jan
(46) |
Feb
(18) |
Mar
(95) |
Apr
(76) |
May
(140) |
Jun
(98) |
Jul
(84) |
Aug
(123) |
Sep
(94) |
Oct
(131) |
Nov
(142) |
Dec
(125) |
2010 |
Jan
(128) |
Feb
(158) |
Mar
(172) |
Apr
(134) |
May
(94) |
Jun
(84) |
Jul
(32) |
Aug
(127) |
Sep
(167) |
Oct
(109) |
Nov
(69) |
Dec
(78) |
2011 |
Jan
(39) |
Feb
(58) |
Mar
(52) |
Apr
(47) |
May
(56) |
Jun
(76) |
Jul
(55) |
Aug
(54) |
Sep
(165) |
Oct
(255) |
Nov
(328) |
Dec
(263) |
2012 |
Jan
(82) |
Feb
(147) |
Mar
(400) |
Apr
(216) |
May
(209) |
Jun
(160) |
Jul
(86) |
Aug
(141) |
Sep
(156) |
Oct
(6) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(2) |
2016 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
(8) |
Jul
(2) |
Aug
(5) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
From: <jpi...@us...> - 2012-05-16 08:00:54
|
Revision: 10448 http://octave.svn.sourceforge.net/octave/?rev=10448&view=rev Author: jpicarbajal Date: 2012-05-16 08:00:43 +0000 (Wed, 16 May 2012) Log Message: ----------- geometry: Adding file from Simeneon Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/inst/geom2d/closed_path.m Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2012-05-15 20:40:30 UTC (rev 10447) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2012-05-16 08:00:43 UTC (rev 10448) @@ -1,7 +1,7 @@ Name: Geometry Version: 1.5.0 Date: 2012-04-16 -Author: David Legland <dav...@gr...>, José Luis García Pallero <jgp...@gm...>, Juan Pablo Carbajal <car...@if...> +Author: David Legland <dav...@gr...>, José Luis García Pallero <jgp...@gm...>, Juan Pablo Carbajal <car...@if...>, Simeon Simeonov <ss...@ca...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Description: Library for geometric computing extending MatGeom functions. Useful to create, transform, manipulate and display geometric primitives. Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-05-15 20:40:30 UTC (rev 10447) +++ trunk/octave-forge/main/geometry/INDEX 2012-05-16 08:00:43 UTC (rev 10448) @@ -14,6 +14,7 @@ polygons2d 2D Points centroid + closed_path distancePoints drawPoint isCounterClockwise Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-05-15 20:40:30 UTC (rev 10447) +++ trunk/octave-forge/main/geometry/NEWS 2012-05-16 08:00:43 UTC (rev 10448) @@ -30,6 +30,9 @@ expandPolygon.m, medialAxisConvex.m, polygonLoops.m, polygonSelfIntersections.m polylineSelfIntersections.m, splitPolygons.m + - close_path.m : given a set of points in the plane calculate a piecewise linear + simple path that passes through all points. + * Changed functions: - distancePointEdge.m: Now the function computes the distance between all points and all edges. A third optional argument provides Added: trunk/octave-forge/main/geometry/inst/geom2d/closed_path.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom2d/closed_path.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom2d/closed_path.m 2012-05-16 08:00:43 UTC (rev 10448) @@ -0,0 +1,105 @@ +%% Copyright (C) 2012 Simeon Simeonov <sim...@gm...> +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 3 of the License, or +%% (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, see <http://www.gnu.org/licenses/>. +%% +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{y} =} polygon (@var{x}) +%% Returns a simple closed path that passes through all the points in x. +%% x is a vector containing 2D coordinates of the points. +%% +%% @end deftypefn + +%% Author: Simeon Simeonov <sim...@gm...> + +function y = closed_path(x) + + if(size(x,1) > 1 && size(x,1) < size(x,2)) + x = x'; + end + + N = size(x,1); % Number of points + idx = zeros(N, 1); % ind contains the indices of the sorted coordinates + + a = find(x(:,2)==min(x(:,2))); + + if(size(a,1) > 1) + [~, i] = sort(x(a,1)); + a = a(i(1)); + end + + x_1 = x(x(:,2)==x(a,2),:); % find all x with the same y coordinate + + if(x(a,1) == min(x(:,1))) + x_2 = x(x(:,1)==x(a,1),:); % find all x with the same x coordinate + else + x_2 = x(a,:); + end + + if(size(x_1,1) > 1 || size(x_2,1) > 1) + if(size(x_1,1) > 1) + x_1 = sort(x_1); % Sort by x coordinate + y(1,:) = x(a,:); % original starting point + end + + if (size(x_2,1) > 1) + x_2 = sort(x_2, 'descend'); + end + + x_not = [x_1; x_2]; + i = ismember(x,x_not,'rows'); + x(i, :) = []; + x = [x_1(size(x_1,1),:); x]; + x_1(size(x_1, 1),:) = []; + N = size(x,1); + a = 1; + else + x_1 = []; + x_2 = x(a,:); + end + d = x - repmat(x(a,:), N, 1); + th = d(:,2)./(d(:,1) + d(:,2)); + + [~, idx0] = ismember(sort(th(th==0)), th); + [~, idx1] = ismember(sort(th(th>0)), th); + [~, idx2] = ismember(sort(th(th<0)), th); + + idx = [a; idx0; idx1; idx2]; + % I contains the indices of idx in a sorted order. [v i] = sort(idx) then + % i==I. + [~,I,J]= unique(idx); + if(size(I,1) ~= size(J,1)) + R = histc(J, 1:size(I,1)); % R(1) will always be 1? + idx_sorted = idx(I); + r = find(R>1); + for ri = r' + idx_repeated = idx_sorted(ri); + idx(idx==idx_repeated) = find(th==th(idx_sorted(ri))); + end + end + + y = [x_1; x(idx,:); x_2;]; + +endfunction + +%!demo +%! maxInt = 100; +%! N = 25; +%! +%! for i = 1:5 +%! x = randi(maxInt, N, 2); +%! y = closed_path(x); +%! plot(y(:,1), y(:,2), '*'); +%! hold on; +%! plot(y(:,1), y(:,2)); +%! end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-15 20:40:36
|
Revision: 10447 http://octave.svn.sourceforge.net/octave/?rev=10447&view=rev Author: paramaniac Date: 2012-05-15 20:40:30 +0000 (Tue, 15 May 2012) Log Message: ----------- control-devel: minor changes Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/arx.m Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 20:01:20 UTC (rev 10446) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 20:40:30 UTC (rev 10447) @@ -130,6 +130,10 @@ function x = __ls_svd__ (A, b) + ## solve the problem Ax=b + ## x = A\b would also work, + ## but this way we have better control and warnings + ## solve linear least squares problem by pseudoinverse ## the pseudoinverse is computed by singular value decomposition ## M = U S V* ---> M+ = V S+ U* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-15 20:01:27
|
Revision: 10446 http://octave.svn.sourceforge.net/octave/?rev=10446&view=rev Author: paramaniac Date: 2012-05-15 20:01:20 +0000 (Tue, 15 May 2012) Log Message: ----------- control-devel: minor changes Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/arx.m Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 15:22:00 UTC (rev 10445) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 20:01:20 UTC (rev 10446) @@ -26,6 +26,8 @@ function sys = arx (dat, na, nb) + ## TODO: delays + if (nargin != 3) print_usage (); endif @@ -97,9 +99,10 @@ function theta = __theta__ (phi, y, i, n) if (numel (phi) == 1) # single-experiment dataset + ## use "square-root algorithm" A = horzcat (phi{1}, y{1}(n(i)+1:end, i)); # [Phi, Y] R0 = triu (qr (A, 0)); # 0 for economy-size R (without zero rows) - R1 = R0(1:end-1, 1:end-1); # R1 is triangular - can we exploit this in R1\R2 + R1 = R0(1:end-1, 1:end-1); # R1 is triangular - can we exploit this in R1\R2? R2 = R0(1:end-1, end); theta = __ls_svd__ (R1, R2); # R1 \ R2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-15 15:22:10
|
Revision: 10445 http://octave.svn.sourceforge.net/octave/?rev=10445&view=rev Author: paramaniac Date: 2012-05-15 15:22:00 +0000 (Tue, 15 May 2012) Log Message: ----------- control-devel: arx: use Ljung's QR method Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/arx.m Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 14:40:12 UTC (rev 10444) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 15:22:00 UTC (rev 10445) @@ -95,14 +95,17 @@ function theta = __theta__ (phi, y, i, n) - - ## Theta = Phi \ Y(n+1:end, :); # naive formula - if (numel (phi) == 1) - ## single-experiment dataset - theta = __ls_svd__ (phi{1}, y{1}(n(i)+1:end, i)); - else - ## multi-experiment dataset + if (numel (phi) == 1) # single-experiment dataset + A = horzcat (phi{1}, y{1}(n(i)+1:end, i)); # [Phi, Y] + R0 = triu (qr (A, 0)); # 0 for economy-size R (without zero rows) + R1 = R0(1:end-1, 1:end-1); # R1 is triangular - can we exploit this in R1\R2 + R2 = R0(1:end-1, end); + theta = __ls_svd__ (R1, R2); # R1 \ R2 + + ## Theta = Phi \ Y(n+1:end, :); # naive formula + ## theta = __ls_svd__ (phi{1}, y{1}(n(i)+1:end, i)); + else # multi-experiment dataset ## TODO: find more sophisticated formula than ## Theta = (Phi1' Phi + Phi2' Phi2 + ...) \ (Phi1' Y1 + Phi2' Y2 + ...) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-15 14:40:21
|
Revision: 10444 http://octave.svn.sourceforge.net/octave/?rev=10444&view=rev Author: paramaniac Date: 2012-05-15 14:40:12 +0000 (Tue, 15 May 2012) Log Message: ----------- control-devel: style fix Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/arx.m Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 14:15:20 UTC (rev 10443) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 14:40:12 UTC (rev 10444) @@ -97,10 +97,8 @@ function theta = __theta__ (phi, y, i, n) ## Theta = Phi \ Y(n+1:end, :); # naive formula - - ex = numel (phi); # number of experiments - - if (ex == 1) + + if (numel (phi) == 1) ## single-experiment dataset theta = __ls_svd__ (phi{1}, y{1}(n(i)+1:end, i)); else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-15 14:15:31
|
Revision: 10443 http://octave.svn.sourceforge.net/octave/?rev=10443&view=rev Author: carandraug Date: 2012-05-15 14:15:20 +0000 (Tue, 15 May 2012) Log Message: ----------- padarray: do not mix spaces and tabs Modified Paths: -------------- trunk/octave-forge/main/image/inst/padarray.m Modified: trunk/octave-forge/main/image/inst/padarray.m =================================================================== --- trunk/octave-forge/main/image/inst/padarray.m 2012-05-15 13:58:12 UTC (rev 10442) +++ trunk/octave-forge/main/image/inst/padarray.m 2012-05-15 14:15:20 UTC (rev 10443) @@ -14,9 +14,9 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{B} = } padarray (@var{A},@var{padsize}) -## @deftypefnx {Function File} {@var{B} = } padarray (@var{A},@var{padsize},@var{padval}) -## @deftypefnx {Function File} {@var{B} = } padarray (@var{A},@var{padsize},@var{padval},@var{direction}) +## @deftypefn {Function File} {@var{B} =} padarray (@var{A}, @var{padsize}) +## @deftypefnx {Function File} {@var{B} =} padarray (@var{A}, @var{padsize}, @var{padval}) +## @deftypefnx {Function File} {@var{B} =} padarray (@var{A}, @var{padsize}, @var{padval}, @var{direction}) ## Pads an array in a configurable way. ## ## B = padarray(A,padsize) pads an array @var{A} with zeros, where @@ -97,116 +97,116 @@ ds = size(B); ds = [ds, ones(1,dim-length(ds))]; # data size ps = ds; - ps(dim) = s; # padding size + ps(dim) = s; # padding size if (ischar(padval)) - # Init a "index all" cell array. All cases need it. - idx = cell(1, length(ds)); - for i = 1:length(ds) - idx{i} = 1:ds(i); - endfor + # Init a "index all" cell array. All cases need it. + idx = cell(1, length(ds)); + for i = 1:length(ds) + idx{i} = 1:ds(i); + endfor - switch (padval) - case ("circular") - complete = 0; - D = B; - if (ps(dim) > ds(dim)) - complete = floor(ps(dim)/ds(dim)); - ps(dim) = rem(ps(dim), ds(dim)); - endif - if (pre) - for i = 1:complete - B = cat(dim, D, B); - endfor - idxt = idx; - idxt{dim} = ds(dim)-ps(dim)+1:ds(dim); - B = cat(dim, D(idxt{:}), B); - endif - if (post) - for i = 1:complete - B = cat(dim, B, D); - endfor - idxt = idx; - idxt{dim} = 1:ps(dim); - B = cat(dim, B, D(idxt{:})); - endif - # end circular case + switch (padval) + case ("circular") + complete = 0; + D = B; + if (ps(dim) > ds(dim)) + complete = floor(ps(dim)/ds(dim)); + ps(dim) = rem(ps(dim), ds(dim)); + endif + if (pre) + for i = 1:complete + B = cat(dim, D, B); + endfor + idxt = idx; + idxt{dim} = ds(dim)-ps(dim)+1:ds(dim); + B = cat(dim, D(idxt{:}), B); + endif + if (post) + for i = 1:complete + B = cat(dim, B, D); + endfor + idxt = idx; + idxt{dim} = 1:ps(dim); + B = cat(dim, B, D(idxt{:})); + endif + # end circular case - case ("replicate") - if (pre) - idxt = idx; - idxt{dim} = 1; - pad = B(idxt{:}); - # can we do this without the loop? - for i = 1:s - B = cat(dim, pad, B); - endfor - endif - if (post) - idxt = idx; - idxt{dim} = size(B, dim); - pad = B(idxt{:}); - for i = 1:s - B = cat(dim, B, pad); - endfor - endif - # end replicate case - - case ("symmetric") - if (ps(dim) > ds(dim)) - error("padarray: padding is longer than data using symmetric padding"); - endif - if (pre) - idxt = idx; - idxt{dim} = ps(dim):-1:1; - B = cat(dim, B(idxt{:}), B); - endif - if (post) - idxt = idx; - sbd = size(B, dim); - idxt{dim} = sbd:-1:sbd-ps(dim)+1; - B = cat(dim, B, B(idxt{:})); - endif - # end symmetric case + case ("replicate") + if (pre) + idxt = idx; + idxt{dim} = 1; + pad = B(idxt{:}); + # can we do this without the loop? + for i = 1:s + B = cat(dim, pad, B); + endfor + endif + if (post) + idxt = idx; + idxt{dim} = size(B, dim); + pad = B(idxt{:}); + for i = 1:s + B = cat(dim, B, pad); + endfor + endif + # end replicate case + + case ("symmetric") + if (ps(dim) > ds(dim)) + error("padarray: padding is longer than data using symmetric padding"); + endif + if (pre) + idxt = idx; + idxt{dim} = ps(dim):-1:1; + B = cat(dim, B(idxt{:}), B); + endif + if (post) + idxt = idx; + sbd = size(B, dim); + idxt{dim} = sbd:-1:sbd-ps(dim)+1; + B = cat(dim, B, B(idxt{:})); + endif + # end symmetric case - case ("reflect") - if (ps(dim) > ds(dim)-1) - error("padarray: padding is longer than data using 'reflect' padding"); - endif - if (pre) - idxt = idx; - idxt{dim} = (ps(dim):-1:1) + 1; - B = cat(dim, B(idxt{:}), B); - endif - if (post) - idxt = idx; - sbd = size(B, dim)-1; - idxt{dim} = sbd:-1:sbd-ps(dim)+1; - B = cat(dim,B,B(idxt{:})); - endif - # end reflect case + case ("reflect") + if (ps(dim) > ds(dim)-1) + error("padarray: padding is longer than data using 'reflect' padding"); + endif + if (pre) + idxt = idx; + idxt{dim} = (ps(dim):-1:1) + 1; + B = cat(dim, B(idxt{:}), B); + endif + if (post) + idxt = idx; + sbd = size(B, dim)-1; + idxt{dim} = sbd:-1:sbd-ps(dim)+1; + B = cat(dim,B,B(idxt{:})); + endif + # end reflect case - otherwise - error("padarray: invalid string in padval parameter."); + otherwise + error("padarray: invalid string in padval parameter."); - endswitch - # end cases where padval is a string + endswitch + # end cases where padval is a string elseif (isscalar(padval)) - # Handle fixed value padding - if (padval == 0) - pad = zeros(ps, class(A)); ## class(pad) = class(A) - else - pad = padval*ones(ps, class(A)); ## class(pad) = class(A) - endif - if (pre && post) - # check if this is not quicker than just 2 calls (one for each) - B = cat(dim, pad, B, pad); - elseif (pre) - B = cat(dim, pad, B); - elseif (post) - B = cat(dim, B, pad); - endif + # Handle fixed value padding + if (padval == 0) + pad = zeros(ps, class(A)); ## class(pad) = class(A) + else + pad = padval*ones(ps, class(A)); ## class(pad) = class(A) + endif + if (pre && post) + # check if this is not quicker than just 2 calls (one for each) + B = cat(dim, pad, B, pad); + elseif (pre) + B = cat(dim, pad, B); + elseif (post) + B = cat(dim, B, pad); + endif endif endif dim+=1; @@ -249,10 +249,10 @@ % Test padding on 3D array %!test %! int8(0); % fail for octave <= 2.1.57 without crashing -%! assert(padarray([1,2,3;4,5,6],[3,2,1]), cat(3, \ -%! zeros(8,7), \ -%! [zeros(3,7); [zeros(2,2), [1,2,3;4,5,6], zeros(2,2)]; zeros(3,7)], \ -%! zeros(8,7))); +%! assert(padarray([1,2,3;4,5,6],[3,2,1]), cat(3, \ +%! zeros(8,7), \ +%! [zeros(3,7); [zeros(2,2), [1,2,3;4,5,6], zeros(2,2)]; zeros(3,7)], \ +%! zeros(8,7))); % Test if default param are ok %!assert(padarray([1,2],[4,5])==padarray([1,2],[4,5],0)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-15 13:58:23
|
Revision: 10442 http://octave.svn.sourceforge.net/octave/?rev=10442&view=rev Author: paramaniac Date: 2012-05-15 13:58:12 +0000 (Tue, 15 May 2012) Log Message: ----------- control-devel: use svd for multi-experiment data Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/CDplayerARX.m trunk/octave-forge/extra/control-devel/inst/arx.m Modified: trunk/octave-forge/extra/control-devel/devel/CDplayerARX.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/CDplayerARX.m 2012-05-15 12:51:58 UTC (rev 10441) +++ trunk/octave-forge/extra/control-devel/devel/CDplayerARX.m 2012-05-15 13:58:12 UTC (rev 10442) @@ -51,7 +51,7 @@ dat = iddata (Y, U) % [sys, x0] = ident (dat, 15, 8) % s=15, n=8 -sys = arx (dat, 4, [4 4]) +sys = arx (dat, 4, 4) %[y, t] = lsim (sys, U, [], x0); %[y, t] = lsim (sys(:,1:2), U); Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 12:51:58 UTC (rev 10441) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 13:58:12 UTC (rev 10442) @@ -102,25 +102,7 @@ if (ex == 1) ## single-experiment dataset - - ## solve linear least squares problem by pseudoinverse - ## the pseudoinverse is computed by singular value decomposition - ## M = U S V* ---> M+ = V S+ U* - ## Th = Ph \ Y = Ph+ Y - ## Th = V S+ U* Y, S+ = 1 ./ diag (S) - - [U, S, V] = svd (phi{1}, 0); # 0 for "economy size" decomposition - S = diag (S); # extract main diagonal - r = sum (S > eps*S(1)); - if (r < length (S)) - warning ("arx: rank-deficient coefficient matrix"); - warning ("sampling time too small"); - warning ("persistence of excitation"); - endif - V = V(:, 1:r); - S = S(1:r); - U = U(:, 1:r); - theta = V * (S .\ (U' * y{1}(n(i)+1:end, i))); # U' is the conjugate transpose + theta = __ls_svd__ (phi{1}, y{1}(n(i)+1:end, i)); else ## multi-experiment dataset ## TODO: find more sophisticated formula than @@ -136,7 +118,31 @@ PhiTY = plus (tmp{:}); ## pseudoinverse Theta = C \ Phi'Y - theta = C \ PhiTY; + theta = __ls_svd__ (C, PhiTY); endif endfunction + + +function x = __ls_svd__ (A, b) + + ## solve linear least squares problem by pseudoinverse + ## the pseudoinverse is computed by singular value decomposition + ## M = U S V* ---> M+ = V S+ U* + ## Th = Ph \ Y = Ph+ Y + ## Th = V S+ U* Y, S+ = 1 ./ diag (S) + + [U, S, V] = svd (A, 0); # 0 for "economy size" decomposition + S = diag (S); # extract main diagonal + r = sum (S > eps*S(1)); + if (r < length (S)) + warning ("arx: rank-deficient coefficient matrix"); + warning ("sampling time too small"); + warning ("persistence of excitation"); + endif + V = V(:, 1:r); + S = S(1:r); + U = U(:, 1:r); + x = V * (S .\ (U' * b)); # U' is the conjugate transpose + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-15 12:52:09
|
Revision: 10441 http://octave.svn.sourceforge.net/octave/?rev=10441&view=rev Author: carandraug Date: 2012-05-15 12:51:58 +0000 (Tue, 15 May 2012) Log Message: ----------- imcrop: new function for image package. Submitted to mailing list by Pablo Rossi <pr...@in...> Modified Paths: -------------- trunk/octave-forge/main/image/INDEX trunk/octave-forge/main/image/NEWS Added Paths: ----------- trunk/octave-forge/main/image/inst/imcrop.m Modified: trunk/octave-forge/main/image/INDEX =================================================================== --- trunk/octave-forge/main/image/INDEX 2012-05-15 06:42:56 UTC (rev 10440) +++ trunk/octave-forge/main/image/INDEX 2012-05-15 12:51:58 UTC (rev 10441) @@ -95,6 +95,7 @@ poly2mask roicolor Spatial transformations + imcrop impad imperspectivewarp imremap Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-05-15 06:42:56 UTC (rev 10440) +++ trunk/octave-forge/main/image/NEWS 2012-05-15 12:51:58 UTC (rev 10441) @@ -11,6 +11,7 @@ imabsdiff imadd imbothat + imcrop imdivide imlincomb immultiply Added: trunk/octave-forge/main/image/inst/imcrop.m =================================================================== --- trunk/octave-forge/main/image/inst/imcrop.m (rev 0) +++ trunk/octave-forge/main/image/inst/imcrop.m 2012-05-15 12:51:58 UTC (rev 10441) @@ -0,0 +1,63 @@ +## Copyright (C) 2012 Pablo Rossi <pr...@in...> +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 3 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} @var{col} = imcrop (@var{Img}) +## Crop image. +## +## Displays the image @var{Img} in a figure window and creates a +## cropping tool associated with that image. Pick: first the top left +## corner, second bottom right. The cropped image returned, @var{col}. +## @end deftypefn + +## Author: Pablo Rossi <pr...@in...> +## Date: 13 March 2012 + +function col = imcrop (Img) + + imshow(Img); + [a,b]=size(Img); + [hl,rd]=ginput; + + if hl(1)<=1; hl(1)=1; endif + + if rd(1)<=1; rd(1)=1; endif + + if hl(2)>=b; hl(2)=b; endif + + if rd(2)>=a; rd(2)=a; endif + + while hl(1) > hl(2) || rd(1) > rd(2) + + display ("Pick: first the top left corner, second bottom right","Error Procedure"); + + [hl,rd]=ginput; + + if hl(1)<=1; hl(1)=1; endif + + if rd(1)<=1; rd(1)=1; endif + + if hl(2)>=b; hl(2)=b; endif + + if rd(2)>=a; rd(2)=a; endif + + endwhile + + hl=floor(hl); + rd=floor(rd); + col=[]; + col=Img(rd(1):rd(2),hl(1):hl(2)); + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-15 06:43:02
|
Revision: 10440 http://octave.svn.sourceforge.net/octave/?rev=10440&view=rev Author: paramaniac Date: 2012-05-15 06:42:56 +0000 (Tue, 15 May 2012) Log Message: ----------- control-devel: add todo Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/arx.m Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-14 19:29:32 UTC (rev 10439) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-15 06:42:56 UTC (rev 10440) @@ -128,6 +128,7 @@ ## covariance matrix C = (Phi1' Phi + Phi2' Phi2 + ...) tmp = cellfun (@(Phi) Phi.' * Phi, phi, "uniformoutput", false); + rc = cellfun (@rcond, tmp); # C auch noch testen? QR oder SVD? C = plus (tmp{:}); ## PhiTY = (Phi1' Y1 + Phi2' Y2 + ...) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-14 19:29:38
|
Revision: 10439 http://octave.svn.sourceforge.net/octave/?rev=10439&view=rev Author: paramaniac Date: 2012-05-14 19:29:32 +0000 (Mon, 14 May 2012) Log Message: ----------- control-devel: warning for rank-deficient coefficient matrix Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/arx.m Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-14 17:23:29 UTC (rev 10438) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-14 19:29:32 UTC (rev 10439) @@ -112,6 +112,11 @@ [U, S, V] = svd (phi{1}, 0); # 0 for "economy size" decomposition S = diag (S); # extract main diagonal r = sum (S > eps*S(1)); + if (r < length (S)) + warning ("arx: rank-deficient coefficient matrix"); + warning ("sampling time too small"); + warning ("persistence of excitation"); + endif V = V(:, 1:r); S = S(1:r); U = U(:, 1:r); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 17:23:38
|
Revision: 10438 http://octave.svn.sourceforge.net/octave/?rev=10438&view=rev Author: carandraug Date: 2012-05-14 17:23:29 +0000 (Mon, 14 May 2012) Log Message: ----------- imhist: complete rewrite of the function to be matlab compatible. Added test cases. No old code left so removed old copyright owners. Modified Paths: -------------- trunk/octave-forge/main/image/NEWS trunk/octave-forge/main/image/inst/imhist.m Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-05-14 09:04:23 UTC (rev 10437) +++ trunk/octave-forge/main/image/NEWS 2012-05-14 17:23:29 UTC (rev 10438) @@ -54,6 +54,10 @@ isind mat2gray + ** `imhist' is much more compatible with matlab and among other changes, + it now uses the whole range of the class for the histogram rather than + the minimum and maximum of the input image. + ** `isbw' now defines a black-and-white image as a binary non-sparse matrix. This is compatible with matlab. To use the old behaviour, use the new option for the call "isbw (img, "non-logical"). Modified: trunk/octave-forge/main/image/inst/imhist.m =================================================================== --- trunk/octave-forge/main/image/inst/imhist.m 2012-05-14 09:04:23 UTC (rev 10437) +++ trunk/octave-forge/main/image/inst/imhist.m 2012-05-14 17:23:29 UTC (rev 10438) @@ -1,6 +1,4 @@ -## Copyright (C) 1999,2000 Kai Habel <kai...@gm...> -## Copyright (C) 2000 Paul Kienzle <pki...@us...> -## Copyright (C) 2011 Carnë Draug <car...@gm...> +## Copyright (C) 2011, 2012 Carnë Draug <car...@gm...> ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -20,7 +18,7 @@ ## @deftypefnx {Function File} {} imhist (@var{I}, @var{n}) ## @deftypefnx {Function File} {} imhist (@var{X}, @var{cmap}) ## @deftypefnx {Function File} {[@var{counts}, @var{x}] =} imhist (@dots{}) -## Shows the histogram of an image @var{I}. +## Produce histogram counts of image @var{I}. ## ## The second argument can either be @var{n}, a scalar that specifies the number ## of bins; or @var{cmap}, a colormap in which case @var{X} is expected to be @@ -30,65 +28,142 @@ ## If output is requested, @var{counts} is the number of counts for each bin and ## @var{x} is a range for the bins so that @code{stem (@var{x}, @var{counts})} will ## show the histogram. +## +## Since a colorbar is not displayed under the histogram, calling this function +## to visualize the histogram of an indexed image may not be very helpful. +## ## @seealso{hist, histc, histeq} ## @end deftypefn -function [nn, bins] = imhist (I, b) +function [varargout] = imhist (img, b) + ## then img can either be a "normal" or indexed image. We will need to + ## check the second argument to find out + indexed = false; + if (nargin < 1 || nargin > 2) - print_usage(); + print_usage; elseif (nargin == 1) - if (islogical(I)) - bins = 0:1; + if (islogical (img)) + b = 2; else - bins = 0:255; + b = 256; endif elseif (nargin == 2) - ## A matrix with 3 columns is a colormap so... - if (ismatrix (b) && columns (b) == 3) - using_colormap = true; + if (iscolormap (b)) ## if using a colormap, image must be an indexed image - if (!isind(I)) - error ("second argument is a colormap but image is not indexed"); + indexed = true; + elseif (isnumeric (b) && isscalar (b) && fix(b) == b) + ## do nothing, all is good + if (islogical (img) && b != 2) + error ("there can only be 2 bins when input image is binary") endif - max_idx = max (I(:)); - bins = 0:rows(b)-1; - if (max_idx > bins(end)) - warning ("largest index exceeds length of colormap"); - endif - elseif (isnumeric (b) && isscalar (b) && fix(b) == b) - bins = 0:b-1; else error ("second argument should either be a positive integer scalar or a colormap"); endif endif - ## matlab returns bins as one column and not one row so we transpose the range - bins = bins'; + ## check if img is good + if (indexed) + if (!isind(img)) + error ("second argument is a colormap but image is not indexed"); + endif + ## an indexed image reads differently wether it's uint8/16 or double + ## If uint8/16, index-1 is the colormap row number (there's an offset of 1) + ## If double, index is the colormap row number (no offset) + ## isind above already checks for double/uint8/uint16 so we can use isinteger + ## and isfloat safely + if ( (isfloat (img) && max (img(:)) > rows(b) ) || + (isinteger (img) && max (img(:)) > rows(b)-1) ) + warning ("largest index in image exceeds length of colormap"); + endif + endif - ## XXX at the moment, this function is not working at all, at least for - ## grayscale images. I'm assuming that the code will at least be working for - ## indexed images and colormaps so I'm leaving the original code for those - ## cases and use only the "new" code when "using_colormap" is false - ## Carnë Draug 10/11/2011 - if (nargout == 0) - if (exist ("using_colormap", "var") && using_colormap) - hist (I(:), bins); + ## prepare bins + if (indexed) + if (isinteger (img)) + bins = 0:rows(b)-1; else - [nn] = histc (I(:), bins); - stem (bins, nn); + bins = 1:rows(b); endif else - if (exist ("using_colormap", "var") && using_colormap) - [nn,bins] = hist (I(:), bins); + if (isinteger (img)) + bins = linspace (intmin (class (img)), intmax (class (img)), b); + elseif (islogical (img)) + bins = 0:1; else - [nn] = histc (I(:), bins); + ## image must be single or double + bins = linspace (0, 1, b); endif + ## we will use this bins with histc where they are the edges for each bin + ## but in imhist we want them to be the center of each bin. We can't use + ## hist either since values right in the middle will go to the bottom + ## bin (4.5 will be placed on the bin 4 instead of 5 and this is like + ## matlab, not an octave bug). So we still use histc but we decrease their + ## values by half of bin width and increase it back in the end to return + ## the values (if we did it on the image it would be only one step but + ## would be heavier on the system since images are likely to be larger + ## than bins) + if (!islogical (img)) + bins -= ((bins(2) - bins(1))/2); + endif + ## matlab returns bins as one column instead of a row but only for non + ## indexed images + bins = bins'; + endif - vr_val_cnt = 1; - varargout{vr_val_cnt++} = nn; - varargout{vr_val_cnt++} = bins; + ## if not dealing with indexed image, we may need to make sure values are + ## between get bin values + if (!indexed) + ## while integers could in no way have a value below the minium of their + ## class, floats can have values below zero which need to be truncated + if (isfloat (img)) + img(img < 0) = 0; + endif + ## because we adjusted the bins edge below the max value of the class, and + ## because histc will not count values outside the edges, we need to bring + ## them down (no need to worry about the min because the min edge is already + ## below the mininum of the class). This also adjusts floats above 1 + if (max (img(:)) > bins(end)) + ## in case it's a integer, if we try to assign the non integer values it + ## will fail so we need to make it double. But this means it takes more + ## memory so let's first make sure we need to + if (fix(bins(end)) != bins(end)) + img = double (img); + endif + img(img > bins(end)) = bins(end); + endif endif + [nn] = histc (img(:), bins); + if (!indexed && !islogical(img)) + bins += ((bins(2) - bins(1))/2); + endif + + if (nargout != 0) + varargout{1} = nn; + varargout{2} = bins; + else + stem (bins, nn); + ## would be cool if we managed to have the colormap showed under the + ## histogram like matlab does. Should look into the code of waitfor and + ## colormap to check how to do it + endif endfunction + +%!shared nn, bb, enn, ebb +%! [nn, bb] = imhist(logical([0 1 0 0 1])); +%!assert({nn, bb}, {[3 2]', [0 1]'}) +%! [nn, bb] = imhist([0 0.2 0.4 0.9 1], 5); +%!assert({nn, bb}, {[1 1 1 0 2]', [0 0.25 0.5 0.75 1]'}) +%! [nn, bb] = imhist([-2 0 0.2 0.4 0.9 1 5], 5); +%!assert({nn, bb}, {[2 1 1 0 3]', [0 0.25 0.5 0.75 1]'}) +%! [nn, bb] = imhist(uint8([0 32 255]), 256); +%! enn = zeros(256, 1); enn([1, 33, 256]) = 1; +%! ebb = 0:255; +%!assert({nn, bb}, {enn, ebb'}) +%! [nn, bb] = imhist(int8([-50 0 100]), 31); +%! enn = zeros(31, 1); enn([10, 16, 28]) = 1; +%! ebb = -128:8.5:127; +%!assert({nn, bb}, {enn, ebb'}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 09:04:34
|
Revision: 10437 http://octave.svn.sourceforge.net/octave/?rev=10437&view=rev Author: carandraug Date: 2012-05-14 09:04:23 +0000 (Mon, 14 May 2012) Log Message: ----------- inputParser: texinfo fixes Modified Paths: -------------- trunk/octave-forge/main/general/inst/@inputParser/addOptional.m trunk/octave-forge/main/general/inst/@inputParser/addParamValue.m trunk/octave-forge/main/general/inst/@inputParser/addRequired.m Modified: trunk/octave-forge/main/general/inst/@inputParser/addOptional.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/addOptional.m 2012-05-14 08:46:11 UTC (rev 10436) +++ trunk/octave-forge/main/general/inst/@inputParser/addOptional.m 2012-05-14 09:04:23 UTC (rev 10437) @@ -31,7 +31,7 @@ ## for the argument with name @var{argname}. Alternatively, a function name ## can be used. ## -## See @command{help @inputParser} for examples. +## See @command{help inputParser} for examples. ## ## @emph{Note}: if a string argument does not validate, it will be considered a ## ParamValue key. If an optional argument is not given a validator, anything Modified: trunk/octave-forge/main/general/inst/@inputParser/addParamValue.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/addParamValue.m 2012-05-14 08:46:11 UTC (rev 10436) +++ trunk/octave-forge/main/general/inst/@inputParser/addParamValue.m 2012-05-14 09:04:23 UTC (rev 10437) @@ -29,7 +29,7 @@ ## for the parameter with name @var{argname}. Alternatively, a function name ## can be used. ## -## See @command{help @inputParser} for examples. +## See @command{help inputParser} for examples. ## ## @seealso{inputParser, @@inputParser/addOptional, @@inputParser/addSwitch, ## @@inputParser/addParamValue, @@inputParser/addRequired, @@inputParser/parse} Modified: trunk/octave-forge/main/general/inst/@inputParser/addRequired.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/addRequired.m 2012-05-14 08:46:11 UTC (rev 10436) +++ trunk/octave-forge/main/general/inst/@inputParser/addRequired.m 2012-05-14 09:04:23 UTC (rev 10437) @@ -31,7 +31,7 @@ ## for the argument with name @var{argname}. Alternatively, a function name ## can be used. ## -## See @command{help @inputParser} for examples. +## See @command{help inputParser} for examples. ## ## @emph{Note}: this can be used together with the other type of arguments but ## it must be the first (see @command{@@inputParser}). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 08:46:17
|
Revision: 10436 http://octave.svn.sourceforge.net/octave/?rev=10436&view=rev Author: carandraug Date: 2012-05-14 08:46:11 +0000 (Mon, 14 May 2012) Log Message: ----------- general: bump version for new release Modified Paths: -------------- trunk/octave-forge/main/general/DESCRIPTION Modified: trunk/octave-forge/main/general/DESCRIPTION =================================================================== --- trunk/octave-forge/main/general/DESCRIPTION 2012-05-14 08:45:29 UTC (rev 10435) +++ trunk/octave-forge/main/general/DESCRIPTION 2012-05-14 08:46:11 UTC (rev 10436) @@ -1,6 +1,6 @@ Name: general -Version: 1.3.0 -Date: 2012-03-30 +Version: 1.3.1 +Date: 2012-05-14 Author: various authors Maintainer: Octave-Forge community <oct...@li...> Title: General This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 08:45:38
|
Revision: 10435 http://octave.svn.sourceforge.net/octave/?rev=10435&view=rev Author: carandraug Date: 2012-05-14 08:45:29 +0000 (Mon, 14 May 2012) Log Message: ----------- general: use environment variable MKOCTFILE if given Modified Paths: -------------- trunk/octave-forge/main/general/src/Makefile Modified: trunk/octave-forge/main/general/src/Makefile =================================================================== --- trunk/octave-forge/main/general/src/Makefile 2012-05-14 08:17:51 UTC (rev 10434) +++ trunk/octave-forge/main/general/src/Makefile 2012-05-14 08:45:29 UTC (rev 10435) @@ -1,4 +1,6 @@ -MKOCTFILE = mkoctfile -Wall +ifndef MKOCTFILE +MKOCTFILE := mkoctfile -Wall +endif PROGS = $(patsubst %.cc,%.oct,$(wildcard *.cc)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 08:18:01
|
Revision: 10434 http://octave.svn.sourceforge.net/octave/?rev=10434&view=rev Author: carandraug Date: 2012-05-14 08:17:51 +0000 (Mon, 14 May 2012) Log Message: ----------- inputParser: mention the validator so its known why argument fails Modified Paths: -------------- trunk/octave-forge/main/general/inst/@inputParser/subsref.m Modified: trunk/octave-forge/main/general/inst/@inputParser/subsref.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/subsref.m 2012-05-14 08:03:43 UTC (rev 10433) +++ trunk/octave-forge/main/general/inst/@inputParser/subsref.m 2012-05-14 08:17:51 UTC (rev 10434) @@ -89,7 +89,7 @@ [name, inPar.copy] = shift (inPar.copy); [value, args] = shift (args); if ( !feval (inPar.Required.(name).validator, value) ) - error("%sargument '%s' failed validation %s", inPar.FunctionName, name, func2str (inPar.Required.(name).validator)); + error_invalid (inPar.FunctionName, name, inPar.Required.(name).validator); endif inPar.Results.(name) = value; endfor @@ -124,7 +124,7 @@ args = unshift (args, value); continue else - error("%sinvalid value for parameter '%s'", inPar.FunctionName, name); + error_invalid (inPar.FunctionName, name, inPar.Optional.(name).validator); endif else inPar.Results.(name) = value; @@ -175,7 +175,7 @@ if (!isempty (index)) [name, inPar.copy] = shift (inPar.copy, index); if ( !feval (inPar.(method).(name).validator, value)) - error("%sinvalid value for parameter '%s'", inPar.FunctionName, key); + error_invalid (inPar.FunctionName, key, inPar.(method).(name).validator); endif ## we use the name shifted from 'copy' instead of the key from 'args' in case ## the key is in the wrong case @@ -301,11 +301,16 @@ ## make sure that the given default value is actually valid ## TODO make sure that when using the default, it's only validated once if ( isa (val, 'function_handle') && !strcmpi (method, 'Required') && !feval (val, def) ) - error ("default value does not validate with '%s'", func2str (val) ); + error ("default value for '%s' failed validation with '%s'", name, func2str (val) ); endif endfunction +## this is just for consistency of error message +function error_invalid (prefix, name, val) + error("%sargument '%s' failed validation %s", prefix, name, func2str (val)); +endfunction + ################################################################################ ## very auxiliary functions ################################################################################ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 08:03:53
|
Revision: 10433 http://octave.svn.sourceforge.net/octave/?rev=10433&view=rev Author: carandraug Date: 2012-05-14 08:03:43 +0000 (Mon, 14 May 2012) Log Message: ----------- inputparser: deal correctly with unmatched parameters Modified Paths: -------------- trunk/octave-forge/main/general/inst/@inputParser/subsref.m Modified: trunk/octave-forge/main/general/inst/@inputParser/subsref.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/subsref.m 2012-05-14 07:35:40 UTC (rev 10432) +++ trunk/octave-forge/main/general/inst/@inputParser/subsref.m 2012-05-14 08:03:43 UTC (rev 10433) @@ -89,7 +89,7 @@ [name, inPar.copy] = shift (inPar.copy); [value, args] = shift (args); if ( !feval (inPar.Required.(name).validator, value) ) - error("%sinvalid value for parameter '%s'", inPar.FunctionName, name); + error("%sargument '%s' failed validation %s", inPar.FunctionName, name, func2str (inPar.Required.(name).validator)); endif inPar.Results.(name) = value; endfor @@ -163,16 +163,16 @@ value = true; method = "Switch"; else - ## then it must be a ParamValue, shift its value + ## then it must be a ParamValue (even if unmatched), shift its value if (numel (args) < 1) - error ("%sno value found for Parameter '%s'", inPar.FunctionName, key); + error ("%sparameter '%s' does not have a value", inPar.FunctionName, key); endif [value, args] = shift (args); method = "ParamValue"; endif - ## index == 0 means no match so either return error or move them into 'Unmatched' - if ( index != 0 ) + ## empty index means no match so either return error or move them into 'Unmatched' + if (!isempty (index)) [name, inPar.copy] = shift (inPar.copy, index); if ( !feval (inPar.(method).(name).validator, value)) error("%sinvalid value for parameter '%s'", inPar.FunctionName, key); @@ -180,11 +180,11 @@ ## we use the name shifted from 'copy' instead of the key from 'args' in case ## the key is in the wrong case inPar.Results.(name) = value; - elseif ( index == 0 && inPar.KeepUnmatched ) + elseif (isempty (index) && inPar.KeepUnmatched ) inPar.Unmatched.(key) = value; i = i - 1; # this time didn't count, go back one - elseif ( index == 0 && !inPar.KeepUnmatched ) - error("%sfound unmatched parameter '%s'", inPar.FunctionName, name); + else + error ("%sargument '%s' did not match any valid parameter of the parser", inPar.FunctionName, key); endif endfor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 07:35:51
|
Revision: 10432 http://octave.svn.sourceforge.net/octave/?rev=10432&view=rev Author: carandraug Date: 2012-05-14 07:35:40 +0000 (Mon, 14 May 2012) Log Message: ----------- inputParser: add note about small bug that needs to be fixed Modified Paths: -------------- trunk/octave-forge/main/general/inst/@inputParser/subsref.m Modified: trunk/octave-forge/main/general/inst/@inputParser/subsref.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/subsref.m 2012-05-14 07:19:05 UTC (rev 10431) +++ trunk/octave-forge/main/general/inst/@inputParser/subsref.m 2012-05-14 07:35:40 UTC (rev 10432) @@ -44,6 +44,12 @@ error ("invalid index for reference of class %s", class (inPar) ); endswitch + ## TODO we should make inPar an object of the inputParser class again. At + ## least after running parse it becomes just a structure again. While that is + ## bad, at least allows for easy access to the Results and Unmatched fields + ## without extra coding. +# inPar = class (inPar, 'inputParser'); + endfunction function out = retrieve_results (inPar, idx) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 07:19:14
|
Revision: 10431 http://octave.svn.sourceforge.net/octave/?rev=10431&view=rev Author: carandraug Date: 2012-05-14 07:19:05 +0000 (Mon, 14 May 2012) Log Message: ----------- inpuParser: check for correct call to parse before starting it to avoid weird errors and print_usage Modified Paths: -------------- trunk/octave-forge/main/general/inst/@inputParser/subsref.m Modified: trunk/octave-forge/main/general/inst/@inputParser/subsref.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/subsref.m 2012-05-14 07:10:59 UTC (rev 10430) +++ trunk/octave-forge/main/general/inst/@inputParser/subsref.m 2012-05-14 07:19:05 UTC (rev 10431) @@ -62,17 +62,17 @@ ## ParamValue mixed with Switch. Any other order makes no sense function inPar = parse_args (inPar, idx) - ## make copy of ordered list of Parameters to keep the original intact and readable - inPar.copy = inPar.Parameters; - - ## this makes it easier to read but may be memory instensive - args = idx(2).subs; - ## syntax is inPar.parse (arguments) if ( numel(idx) != 2 || idx(2).type != '()' ) print_usage ("@inputParser/parse"); endif + ## this makes it easier to read but may be memory instensive + args = idx(2).subs; + + ## make copy of ordered list of Parameters to keep the original intact and readable + inPar.copy = inPar.Parameters; + if ( numel (fieldnames (inPar.Required)) > numel (args) ) error("%sNot enough arguments", inPar.FunctionName); endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-14 07:11:05
|
Revision: 10430 http://octave.svn.sourceforge.net/octave/?rev=10430&view=rev Author: carandraug Date: 2012-05-14 07:10:59 +0000 (Mon, 14 May 2012) Log Message: ----------- inputParser: proper and pretty display method for class Modified Paths: -------------- trunk/octave-forge/main/general/inst/@inputParser/display.m Modified: trunk/octave-forge/main/general/inst/@inputParser/display.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/display.m 2012-05-12 19:04:36 UTC (rev 10429) +++ trunk/octave-forge/main/general/inst/@inputParser/display.m 2012-05-14 07:10:59 UTC (rev 10430) @@ -1,4 +1,4 @@ -## Copyright (C) 2011 Carnë Draug <car...@gm...> +## Copyright (C) 2011-2012 Carnë Draug <car...@gm...> ## ## This program is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free Software @@ -15,10 +15,44 @@ function display (inPar) - fields = fieldnames (inPar); - for i = 1 : numel(fields) - printf ("%s\n", fields{i}); - inPar.(fields{i}) - end + if (inPar.FunctionName) + name = inPar.FunctionName(1:end-3); + else + name = ""; + endif + required = arg_list (inPar.Required); + optional = arg_list (inPar.Optional); + paramvalue = arg_list (inPar.ParamValue); + switches = arg_list (inPar.Switch); + + printf ("Input Parser object with:\n"); + printf ("CaseSensitive: %s\n", binstr (inPar.CaseSensitive)); + printf ("StructExpand : %s\n", binstr (inPar.StructExpand)); + printf ("KeepUnmatched: %s\n", binstr (inPar.KeepUnmatched)); + printf ("FunctionName : '%s'\n", name); + printf ("\n"); + printf ("Required arguments : %s\n", required); + printf ("Optional arguments : %s\n", optional); + printf ("ParamValue arguments: %s\n", paramvalue); + printf ("Switch arguments : %s\n", switches); + endfunction + +function [str] = binstr (bin) + if (bin) + str = "true"; + else + str = "false"; + endif +endfunction + +function [str] = arg_list (args) + str = strcat ("'", fieldnames (args), {"', "}); + if (!isempty (str)) + str = cstrcat (str{:}); + str = str(1:end-2); # remove the last comma and space + else + str = ""; + endif +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-12 19:04:44
|
Revision: 10429 http://octave.svn.sourceforge.net/octave/?rev=10429&view=rev Author: paramaniac Date: 2012-05-12 19:04:36 +0000 (Sat, 12 May 2012) Log Message: ----------- control-devel: subspace identfication Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/arx.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/inst/__slicot_identification__.m trunk/octave-forge/extra/control-devel/inst/moen4.m trunk/octave-forge/extra/control-devel/inst/moesp.m trunk/octave-forge/extra/control-devel/inst/n4sid.m Added: trunk/octave-forge/extra/control-devel/inst/__slicot_identification__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/__slicot_identification__.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/__slicot_identification__.m 2012-05-12 19:04:36 UTC (rev 10429) @@ -0,0 +1,57 @@ +function [sys, x0] = __slicot_identification__ (method, dat, s = [], n = []) + + switch (method) + case "moesp" + meth = 0; + case "n4sid" + meth = 1; + case "moen4" + meth = 2; + otherwise + error ("ident: invalid method"); # should never happen + endswitch + +% meth = 2; % 2 % geht: meth/alg 1/1, + alg = 0; % 0 % geht nicht: meth/alg 0/1 + jobd = 1; + batch = 3; + conct = 1; + ctrl = 0; %1; + rcond = 0.0; + tol = -1.0; % 0; + + [ns, l, m, e] = size (dat); + + if (isempty (s) && isempty (n)) + nsmp = ns(1); + nobr = fix ((nsmp+1)/(2*(m+l+1))); + ctrl = 0; # confirm system order estimate + n = 0; + % nsmp >= 2*(m+l+1)*nobr - 1 + % nobr <= (nsmp+1)/(2*(m+l+1)) + elseif (isempty (s)) + s = min (2*n, n+10); + nsmp = ns(1); + nobr = fix ((nsmp+1)/(2*(m+l+1))); + nobr = min (nobr, s); + ctrl = 1; # no confirmation + elseif (isempty (n)) + nobr = s; + ctrl = 0; # confirm system order estimate + n = 0; + else # s & n non-empty + nsmp = ns(1); + nobr = fix ((nsmp+1)/(2*(m+l+1))); + if (s > nobr) + error ("ident: s > nobr"); + endif + nobr = s; + ctrl = 1; + ## TODO: specify n for IB01BD + endif + + [a, b, c, d, q, ry, s, k, x0] = slident (dat.y{1}, dat.u{1}, nobr, n, meth, alg, jobd, batch, conct, ctrl, rcond, tol); + + sys = ss (a, b, c, d, dat.tsam{1}); + +endfunction Modified: trunk/octave-forge/extra/control-devel/inst/arx.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-12 16:41:38 UTC (rev 10428) +++ trunk/octave-forge/extra/control-devel/inst/arx.m 2012-05-12 19:04:36 UTC (rev 10429) @@ -1,3 +1,25 @@ +## Copyright (C) 2012 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{sys} =} arx (@var{dat}, @var{na}, @var{nb}) +## ARX +## @end deftypefn + ## Author: Lukas Reichlin <luk...@gm...> ## Created: April 2012 ## Version: 0.1 Added: trunk/octave-forge/extra/control-devel/inst/moen4.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/moen4.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/moen4.m 2012-05-12 19:04:36 UTC (rev 10429) @@ -0,0 +1,33 @@ +## Copyright (C) 2012 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{dat} =} moen4 (@var{dat}, @var{s}, @var{n}) +## Combined method: MOESP algorithm for finding the +## matrices A and C, and N4SID algorithm for +## finding the matrices B and D. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: May 2012 +## Version: 0.1 + +function [sys, x0] = moen4 (varargin) + + [sys, x0] = __slicot_identification__ ("moen4", varargin{:}); + +endfunction \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/moesp.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/moesp.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/moesp.m 2012-05-12 19:04:36 UTC (rev 10429) @@ -0,0 +1,31 @@ +## Copyright (C) 2012 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{dat} =} moesp (@var{dat}, @var{s}, @var{n}) +## MOESP. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: May 2012 +## Version: 0.1 + +function [sys, x0] = moesp (varargin) + + [sys, x0] = __slicot_identification__ ("moesp", varargin{:}); + +endfunction \ No newline at end of file Added: trunk/octave-forge/extra/control-devel/inst/n4sid.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/n4sid.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/n4sid.m 2012-05-12 19:04:36 UTC (rev 10429) @@ -0,0 +1,31 @@ +## Copyright (C) 2012 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{dat} =} n4sid (@var{dat}, @var{s}, @var{n}) +## N4SID. +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: May 2012 +## Version: 0.1 + +function [sys, x0] = n4sid (varargin) + + [sys, x0] = __slicot_identification__ ("n4sid", varargin{:}); + +endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-12 16:41:44
|
Revision: 10428 http://octave.svn.sourceforge.net/octave/?rev=10428&view=rev Author: paramaniac Date: 2012-05-12 16:41:38 +0000 (Sat, 12 May 2012) Log Message: ----------- control-devel: sort variables alphabetically Modified Paths: -------------- trunk/octave-forge/extra/control-devel/src/slident.cc Added Paths: ----------- trunk/octave-forge/extra/control-devel/devel/Destillation_combinations.m trunk/octave-forge/extra/control-devel/devel/PowerPlant_combinations.m trunk/octave-forge/extra/control-devel/devel/ident_combinations.m Added: trunk/octave-forge/extra/control-devel/devel/Destillation_combinations.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/Destillation_combinations.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/Destillation_combinations.m 2012-05-12 16:41:38 UTC (rev 10428) @@ -0,0 +1,90 @@ +%{ +This file describes the data in the destill.dat file. +1. Contributed by: + Peter Van Overschee + K.U.Leuven - ESAT - SISTA + K. Mercierlaan 94 + 3001 Heverlee + Pet...@es... +2. Process/Description: + Data of a simulation (not real !) related to the identification + of an ethane-ethylene destillationcolumn. The series consists of 4 + series: + U_dest, Y_dest: without noise (original series) + U_dest_n10, Y_dest_n10: 10 percent additive white noise + U_dest_n20, Y_dest_n20: 20 percent additive white noise + U_dest_n30, Y_dest_n30: 30 percent additive white noise +3. Sampling time + 15 min. +4. Number of samples: + 90 samples +5. Inputs: + a. ratio between the reboiler duty and the feed flow + b. ratio between the reflux rate and the feed flow + c. ratio between the distillate and the feed flow + d. input ethane composition + e. top pressure +6. Outputs: + a. top ethane composition + b. bottom ethylene composition + c. top-bottom differential pressure. +7. References: + R.P. Guidorzi, M.P. Losito, T. Muratori, The range error test in the + structural identification of linear multivariable systems, + IEEE transactions on automatic control, Vol AC-27, pp 1044-1054, oct. + 1982. +8. Known properties/peculiarities + +9. Some MATLAB-code to retrieve the data + !gunzip destill.dat.Z + load destill.dat + U=destill(:,1:20); + Y=destill(:,21:32); + U_dest=U(:,1:5); + U_dest_n10=U(:,6:10); + U_dest_n20=U(:,11:15); + U_dest_n30=U(:,16:20); + Y_dest=Y(:,1:3); + Y_dest_n10=Y(:,4:6); + Y_dest_n20=Y(:,7:9); + Y_dest_n30=Y(:,10:12); +%} + +clear all, close all, clc + +% DaISy code is wrong, +% first column is sample number +load destill.dat +U=destill(:,2:21); +Y=destill(:,22:33); +U_dest=U(:,1:5); +U_dest_n10=U(:,6:10); +U_dest_n20=U(:,11:15); +U_dest_n30=U(:,16:20); +Y_dest=Y(:,1:3); +Y_dest_n10=Y(:,4:6); +Y_dest_n20=Y(:,7:9); +Y_dest_n30=Y(:,10:12); + + +dat = iddata (Y_dest, U_dest); + +err = zeros (3, 3); + +for meth = 0:2 + for alg = 0:2 + [sys, x0] = ident_combinations (dat, 5, 4, meth, alg); % s=5, n=4 + [y, t] = lsim (sys, U_dest, [], x0); + err(meth+1, alg+1) = norm (Y_dest - y, 1) / norm (Y_dest, 1); + endfor +endfor + +err + +%{ +figure (1) +%plot (t, Y_dest, 'b') +plot (t, Y_dest, 'b', t, y, 'r') +legend ('y measured', 'y simulated', 'location', 'southeast') +%} + Added: trunk/octave-forge/extra/control-devel/devel/PowerPlant_combinations.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/PowerPlant_combinations.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/PowerPlant_combinations.m 2012-05-12 16:41:38 UTC (rev 10428) @@ -0,0 +1,92 @@ +%{ +This file describes the data in the powerplant.dat file. +1. Contributed by: + Peter Van Overschee + K.U.Leuven - ESAT - SISTA + K. Mercierlaan 94 + 3001 Heverlee + Pet...@es... +2. Process/Description: + data of a power plant (Pont-sur-Sambre (France)) of 120 MW +3. Sampling time + 1228.8 sec +4. Number of samples: + 200 samples +5. Inputs: + 1. gas flow + 2. turbine valves opening + 3. super heater spray flow + 4. gas dampers + 5. air flow +6. Outputs: + 1. steam pressure + 2. main stem temperature + 3. reheat steam temperature +7. References: + a. R.P. Guidorzi, P. Rossi, Identification of a power plant from normal + operating records. Automatic control theory and applications (Canada, + Vol 2, pp 63-67, sept 1974. + b. Moonen M., De Moor B., Vandenberghe L., Vandewalle J., On- and + off-line identification of linear state-space models, International + Journal of Control, Vol. 49, Jan. 1989, pp.219-232 +8. Known properties/peculiarities + +9. Some MATLAB-code to retrieve the data + !gunzip powerplant.dat.Z + load powerplant.dat + U=powerplant(:,1:5); + Y=powerplant(:,6:8); + Yr=powerplant(:,9:11); + +%} + +clear all, close all, clc + +% NB: the code from DaISy is wrong: +% powerplant(:,1) is just the sample number +% therefore increase indices by one +% it took me weeks to find that silly mistake ... +load powerplant.dat +U=powerplant(:,2:6); +Y=powerplant(:,7:9); +Yr=powerplant(:,10:12); + +inname = {'gas flow', + 'turbine valves opening', + 'super heater spray flow', + 'gas dampers', + 'air flow'}; + +outname = {'steam pressure', + 'main steam temperature', + 'reheat steam temperature'}; + +tsam = 1228.8; + +dat = iddata (Y, U, tsam, 'outname', outname, 'inname', inname) + + +err = zeros (3, 3); + +for meth = 0:2 + for alg = 0:2 + [sys, x0] = ident_combinations (dat, 10, 8, meth, alg); % s=10, n=8 + [y, t] = lsim (sys, U, [], x0); + err(meth+1, alg+1) = norm (Y - y, 1) / norm (Y, 1); + endfor +endfor + +err + +%{ +figure (1) +p = columns (Y); +for k = 1 : p + subplot (3, 1, k) + plot (t, Y(:,k), 'b', t, y(:,k), 'r') +endfor +%title ('DaISy: Power Plant') +%legend ('y measured', 'y simulated', 'location', 'southeast') + +st = isstable (sys) +%} Added: trunk/octave-forge/extra/control-devel/devel/ident_combinations.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/ident_combinations.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/ident_combinations.m 2012-05-12 16:41:38 UTC (rev 10428) @@ -0,0 +1,54 @@ +function [sys, x0] = ident_combinations (dat, s = [], n = [], meth, alg) + + + + %nobr = 15; +% meth = 1; % 2 % geht: meth/alg 1/1, +% alg = 2; % 0 % geht nicht: meth/alg 0/1 + jobd = 1; + batch = 3; + conct = 1; + ctrl = 0; %1; + rcond = 0.0; + tol = -1.0; % 0; + + [ns, l, m, e] = size (dat); + + if (isempty (s) && isempty (n)) + nsmp = ns(1); + nobr = fix ((nsmp+1)/(2*(m+l+1))); + ctrl = 0; # confirm system order estimate + n = 0; + % nsmp >= 2*(m+l+1)*nobr - 1 + % nobr <= (nsmp+1)/(2*(m+l+1)) + elseif (isempty (s)) + s = min (2*n, n+10); + nsmp = ns(1); + nobr = fix ((nsmp+1)/(2*(m+l+1))); + nobr = min (nobr, s); + ctrl = 1; # no confirmation + elseif (isempty (n)) + nobr = s; + ctrl = 0; # confirm system order estimate + n = 0; + else # s & n non-empty + nsmp = ns(1); + nobr = fix ((nsmp+1)/(2*(m+l+1))); + if (s > nobr) + error ("ident: s > nobr"); + endif + nobr = s; + ctrl = 1; + ## TODO: specify n for IB01BD + endif + + %nsmp = ns(1) + %nobr = fix ((nsmp+1)/(2*(m+l+1))) + % nsmp >= 2*(m+l+1)*nobr - 1 + % nobr <= (nsmp+1)/(2*(m+l+1)) +%nobr = 10 + [a, b, c, d, q, ry, s, k, x0] = slident (dat.y{1}, dat.u{1}, nobr, n, meth, alg, jobd, batch, conct, ctrl, rcond, tol); + + sys = ss (a, b, c, d, dat.tsam{1}); + +endfunction Modified: trunk/octave-forge/extra/control-devel/src/slident.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/slident.cc 2012-05-12 15:32:53 UTC (rev 10427) +++ trunk/octave-forge/extra/control-devel/src/slident.cc 2012-05-12 16:41:38 UTC (rev 10428) @@ -137,16 +137,16 @@ switch (imeth) { case 0: + meth_a = 'M'; meth_b = 'M'; - meth_a = 'M'; break; case 1: + meth_a = 'N'; meth_b = 'N'; - meth_a = 'N'; break; case 2: + meth_a = 'N'; // no typo here meth_b = 'C'; - meth_a = 'N'; // no typo here break; default: error ("slib01ad: argument 'meth' invalid"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-05-12 15:33:00
|
Revision: 10427 http://octave.svn.sourceforge.net/octave/?rev=10427&view=rev Author: paramaniac Date: 2012-05-12 15:32:53 +0000 (Sat, 12 May 2012) Log Message: ----------- control-devel: minor changes Modified Paths: -------------- trunk/octave-forge/extra/control-devel/devel/GlassFurnace.m trunk/octave-forge/extra/control-devel/devel/PowerPlant.m trunk/octave-forge/extra/control-devel/src/slident.cc Modified: trunk/octave-forge/extra/control-devel/devel/GlassFurnace.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/GlassFurnace.m 2012-05-12 15:06:57 UTC (rev 10426) +++ trunk/octave-forge/extra/control-devel/devel/GlassFurnace.m 2012-05-12 15:32:53 UTC (rev 10427) @@ -38,7 +38,7 @@ %} -close all, clc +clear all, close all, clc load glassfurnace.dat T=glassfurnace(:,1); Modified: trunk/octave-forge/extra/control-devel/devel/PowerPlant.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/PowerPlant.m 2012-05-12 15:06:57 UTC (rev 10426) +++ trunk/octave-forge/extra/control-devel/devel/PowerPlant.m 2012-05-12 15:32:53 UTC (rev 10427) @@ -40,7 +40,7 @@ %} -close all, clc +clear all, close all, clc % NB: the code from DaISy is wrong: % powerplant(:,1) is just the sample number Modified: trunk/octave-forge/extra/control-devel/src/slident.cc =================================================================== --- trunk/octave-forge/extra/control-devel/src/slident.cc 2012-05-12 15:06:57 UTC (rev 10426) +++ trunk/octave-forge/extra/control-devel/src/slident.cc 2012-05-12 15:32:53 UTC (rev 10427) @@ -405,8 +405,8 @@ "coefficient matrix"}; - error_msg ("ident", info_a, 2, err_msg); - warning_msg ("ident", iwarn_a, 5, warn_msg); + error_msg ("ident: IB01AD", info_a, 2, err_msg); + warning_msg ("ident: IB01AD", iwarn_a, 5, warn_msg); // resize @@ -586,8 +586,8 @@ "gain matrix is set to zero"}; - error_msg ("ident", info_b, 10, err_msg_b); - warning_msg ("ident", iwarn_b, 5, warn_msg_b); + error_msg ("ident: IB01BD", info_b, 10, err_msg_b); + warning_msg ("ident: IB01BD", iwarn_b, 5, warn_msg_b); // resize a.resize (n, n); @@ -682,8 +682,8 @@ "and/or B and D could be inaccurate"}; - error_msg ("ident", info_c, 2, err_msg_c); - warning_msg ("ident", iwarn_c, 6, warn_msg_c); + error_msg ("ident: IB01CD", info_c, 2, err_msg_c); + warning_msg ("ident: IB01CD", iwarn_c, 6, warn_msg_c); // return values This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mtm...@us...> - 2012-05-12 15:07:03
|
Revision: 10426 http://octave.svn.sourceforge.net/octave/?rev=10426&view=rev Author: mtmiller Date: 2012-05-12 15:06:57 +0000 (Sat, 12 May 2012) Log Message: ----------- comm: no longer dependent on image, still depends on signal Modified Paths: -------------- trunk/octave-forge/main/comm/NEWS Modified: trunk/octave-forge/main/comm/NEWS =================================================================== --- trunk/octave-forge/main/comm/NEWS 2012-05-12 14:55:36 UTC (rev 10425) +++ trunk/octave-forge/main/comm/NEWS 2012-05-12 15:06:57 UTC (rev 10426) @@ -3,7 +3,7 @@ ** The function `marcumq' has been moved to the signal package - ** communications is no longer dependent on the signal package + ** communications is no longer dependent on the image package ** The following functions are new: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-12 14:55:42
|
Revision: 10425 http://octave.svn.sourceforge.net/octave/?rev=10425&view=rev Author: carandraug Date: 2012-05-12 14:55:36 +0000 (Sat, 12 May 2012) Log Message: ----------- communications: remove dependency on image since it was only because marcumq which now belongs to signal Modified Paths: -------------- trunk/octave-forge/main/comm/DESCRIPTION trunk/octave-forge/main/comm/NEWS Modified: trunk/octave-forge/main/comm/DESCRIPTION =================================================================== --- trunk/octave-forge/main/comm/DESCRIPTION 2012-05-12 14:42:27 UTC (rev 10424) +++ trunk/octave-forge/main/comm/DESCRIPTION 2012-05-12 14:55:36 UTC (rev 10425) @@ -5,7 +5,7 @@ Maintainer: Octave-Forge community <oct...@li...> Title: Communications. Description: Digital Communications, Error Correcting Codes (Channel Code), Source Code functions, Modulation and Galois Fields -Depends: octave (>= 3.4), signal (>= 1.1.3), image +Depends: octave (>= 3.4), signal (>= 1.1.3) Autoload: no License: GPLv3+ Url: http://octave.sf.net Modified: trunk/octave-forge/main/comm/NEWS =================================================================== --- trunk/octave-forge/main/comm/NEWS 2012-05-12 14:42:27 UTC (rev 10424) +++ trunk/octave-forge/main/comm/NEWS 2012-05-12 14:55:36 UTC (rev 10425) @@ -3,6 +3,8 @@ ** The function `marcumq' has been moved to the signal package + ** communications is no longer dependent on the signal package + ** The following functions are new: convenc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-05-12 14:42:33
|
Revision: 10424 http://octave.svn.sourceforge.net/octave/?rev=10424&view=rev Author: carandraug Date: 2012-05-12 14:42:27 +0000 (Sat, 12 May 2012) Log Message: ----------- signal: remove dependency to communications to avoid circular dependency. While it is ok with pkg install, pkg load will fail in this situation. This was fixed by making bi2de and de2bi subfunctions of bitrevorder. This is a temporary fix and hopefully bitrevorder will be rewritten to not use them at all Modified Paths: -------------- trunk/octave-forge/main/signal/DESCRIPTION trunk/octave-forge/main/signal/NEWS trunk/octave-forge/main/signal/inst/bitrevorder.m Modified: trunk/octave-forge/main/signal/DESCRIPTION =================================================================== --- trunk/octave-forge/main/signal/DESCRIPTION 2012-05-12 14:02:19 UTC (rev 10423) +++ trunk/octave-forge/main/signal/DESCRIPTION 2012-05-12 14:42:27 UTC (rev 10424) @@ -5,7 +5,7 @@ Maintainer: Octave-Forge community <oct...@li...> Title: Signal Processing. Description: Signal processing tools, including filtering, windowing and display functions. -Depends: octave (>= 3.6.0), optim (>= 1.0.0), specfun, control (>= 2.2.3), communications, image +Depends: octave (>= 3.6.0), optim (>= 1.0.0), specfun, control (>= 2.2.3), image Autoload: no License: GPLv3+, public domain Url: http://octave.sf.net Modified: trunk/octave-forge/main/signal/NEWS =================================================================== --- trunk/octave-forge/main/signal/NEWS 2012-05-12 14:02:19 UTC (rev 10423) +++ trunk/octave-forge/main/signal/NEWS 2012-05-12 14:42:27 UTC (rev 10424) @@ -6,7 +6,7 @@ ** signal is no longer dependent on the audio package. - ** signal is now dependent on the communications and image packages. + ** signal is now dependent on the image package. ** The function `marcumq' was imported from the communications package and has been completely rewritten to improve performance and fix computational Modified: trunk/octave-forge/main/signal/inst/bitrevorder.m =================================================================== --- trunk/octave-forge/main/signal/inst/bitrevorder.m 2012-05-12 14:02:19 UTC (rev 10423) +++ trunk/octave-forge/main/signal/inst/bitrevorder.m 2012-05-12 14:42:27 UTC (rev 10424) @@ -34,3 +34,65 @@ y(old_ind+1) = x(i); endfunction + +## The following functions, de2bi and bi2de, are from the communications package. +## However, the communications package is already dependent on the signal +## package and to avoid circular dependencies their code was copied here. Anyway, +## in the future bitrevorder should be rewritten as to not use this functions +## at all (and pkg can be fixed to support circular dependencies on pkg load +## as it already does for pkg install). + +## note that aside copying the code from the communication package, their input +## check was removed since in this context they were always being called with +## nargin == 1 + +function b = de2bi (d, n, p, f) + + p = 2; + n = floor ( log (max (max (d), 1)) ./ log (p) ) + 1; + f = 'right-msb'; + + d = d(:); + if ( any (d < 0) || any (d != floor (d)) ) + error ("de2bi: d must only contain non-negative integers"); + endif + + if (isempty (n)) + n = floor ( log (max (max (d), 1)) ./ log (p) ) + 1; + endif + + power = ones (length (d), 1) * (p .^ [0 : n-1] ); + d = d * ones (1, n); + b = floor (rem (d, p*power) ./ power); + + if (strcmp (f, 'left-msb')) + b = b(:,columns(b):-1:1); + elseif (!strcmp (f, 'right-msb')) + error ("de2bi: unrecognized flag"); + endif + +endfunction + + +function d = bi2de (b, p, f) + + p = 2; + f = 'right-msb'; + + if ( any (b(:) < 0) || any (b(:) != floor (b(:))) || any (b(:) > p - 1) ) + error ("bi2de: d must only contain integers in the range [0, p-1]"); + endif + + if (strcmp (f, 'left-msb')) + b = b(:,size(b,2):-1:1); + elseif (!strcmp (f, 'right-msb')) + error ("bi2de: unrecognized flag"); + endif + + if (length (b) == 0) + d = []; + else + d = b * ( p .^ [ 0 : (columns(b)-1) ]' ); + endif + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |