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: <jo...@us...> - 2012-09-18 18:44:02
|
Revision: 11048 http://octave.svn.sourceforge.net/octave/?rev=11048&view=rev Author: jordigh Date: 2012-09-18 18:43:56 +0000 (Tue, 18 Sep 2012) Log Message: ----------- whitespace fix Modified Paths: -------------- trunk/octave-forge/main/image/src/__bwdist.cc Modified: trunk/octave-forge/main/image/src/__bwdist.cc =================================================================== --- trunk/octave-forge/main/image/src/__bwdist.cc 2012-09-18 15:23:21 UTC (rev 11047) +++ trunk/octave-forge/main/image/src/__bwdist.cc 2012-09-18 18:43:56 UTC (rev 11048) @@ -90,7 +90,7 @@ { const int nargin = args.length(); octave_value_list retval; - + /* Check for proper number of input and output arguments */ if ((nargin < 1) || (nargin>2)) { error ("bwdist accepts only one or two input parameters."); @@ -119,13 +119,13 @@ charMatrix method = args(1).char_matrix_value(); if(method(0) == 'e') caseMethod = 0; // Euclidean; else if (method(0) == 'c') { - if(method(1) == 'h') caseMethod = 1; // chessboard - else if(method(1) == 'i') caseMethod = 2; // cityblock + if(method(1) == 'h') caseMethod = 1; // chessboard + else if(method(1) == 'i') caseMethod = 2; // cityblock } else if(method(0) == 'q') caseMethod = 3; // quasi-Euclidean else { - warning ("unknown metric, using 'euclidean'"); - caseMethod = 0; + warning ("unknown metric, using 'euclidean'"); + caseMethod = 0; } } @@ -141,46 +141,46 @@ switch(caseMethod) { case 1: - chessboard(bw, rows, cols, xdist, ydist); - for(int i=0; i<rows*cols; i++) { - D(i) = DIST_CHESSBOARD(xdist[i], ydist[i]); - } - break; + chessboard(bw, rows, cols, xdist, ydist); + for(int i=0; i<rows*cols; i++) { + D(i) = DIST_CHESSBOARD(xdist[i], ydist[i]); + } + break; case 2: - cityblock(bw, rows, cols, xdist, ydist); - for(int i=0; i<rows*cols; i++) { - D(i) = DIST_CITYBLOCK(xdist[i], ydist[i]); - } - break; + cityblock(bw, rows, cols, xdist, ydist); + for(int i=0; i<rows*cols; i++) { + D(i) = DIST_CITYBLOCK(xdist[i], ydist[i]); + } + break; case 3: - quasi_euclidean(bw, rows, cols, xdist, ydist); - for(int i=0; i<rows*cols; i++) { - D(i) = DIST_QUASI_EUCLIDEAN(xdist[i], ydist[i]); - } - break; + quasi_euclidean(bw, rows, cols, xdist, ydist); + for(int i=0; i<rows*cols; i++) { + D(i) = DIST_QUASI_EUCLIDEAN(xdist[i], ydist[i]); + } + break; case 0: default: - euclidean(bw, rows, cols, xdist, ydist); - /* Remember sqrt() for the final output */ - for(int i=0; i<rows*cols; i++) { - D(i) = sqrt((double)DIST_EUCLIDEAN(xdist[i], ydist[i])); - } - break; + euclidean(bw, rows, cols, xdist, ydist); + /* Remember sqrt() for the final output */ + for(int i=0; i<rows*cols; i++) { + D(i) = sqrt((double)DIST_EUCLIDEAN(xdist[i], ydist[i])); + } + break; } retval(0) = D; if(nargout > 1) { - /* Create a second output array */ - Matrix C (rows, cols); - /* Compute optional 'index to closest object pixel' */ - for(int i=0; i<rows*cols; i++) { - C (i) = i+1 - xdist[i] - ydist[i]*rows; - } - retval(1) = C; + /* Create a second output array */ + Matrix C (rows, cols); + /* Compute optional 'index to closest object pixel' */ + for(int i=0; i<rows*cols; i++) { + C (i) = i+1 - xdist[i] - ydist[i]*rows; + } + retval(1) = C; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-18 15:23:32
|
Revision: 11047 http://octave.svn.sourceforge.net/octave/?rev=11047&view=rev Author: jpicarbajal Date: 2012-09-18 15:23:21 +0000 (Tue, 18 Sep 2012) Log Message: ----------- statistics: fixing notation in docstring of linkage. Still improvements needed. Modified Paths: -------------- trunk/octave-forge/main/mechanics/DESCRIPTION trunk/octave-forge/main/mechanics/inst/core/forcematrix.m trunk/octave-forge/main/statistics/inst/linkage.m Modified: trunk/octave-forge/main/mechanics/DESCRIPTION =================================================================== --- trunk/octave-forge/main/mechanics/DESCRIPTION 2012-09-18 06:25:30 UTC (rev 11046) +++ trunk/octave-forge/main/mechanics/DESCRIPTION 2012-09-18 15:23:21 UTC (rev 11047) @@ -1,6 +1,6 @@ Name: Mechanics -Version: 1.3.0 -Date: 2012-24-08 +Version: 1.3.1 +Date: 2012-29-08 Author: Juan Pablo Carbajal <car...@if...>, Johan Beke <joh...@ho...> Maintainer: Juan Pablo Carbajal <car...@if...>, Johan Beke <joh...@ho...> Title: Classical Mechanics & Structural Analysis Modified: trunk/octave-forge/main/mechanics/inst/core/forcematrix.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/forcematrix.m 2012-09-18 06:25:30 UTC (rev 11046) +++ trunk/octave-forge/main/mechanics/inst/core/forcematrix.m 2012-09-18 15:23:21 UTC (rev 11047) @@ -51,12 +51,13 @@ %% distances between the points. %% @end itemize %% -%% @html -%% @include doc/matrixforce.svg -%% @end html %% @seealso{pointmassmesh, polyval, vech, sub2ind} %% @end deftypefn +%% @html +%% @include ../doc/matrixforce.svg +%% @end html + function [F D dr] = forcematrix (pos, A, funcs) %% Argument parsing Modified: trunk/octave-forge/main/statistics/inst/linkage.m =================================================================== --- trunk/octave-forge/main/statistics/inst/linkage.m 2012-09-18 06:25:30 UTC (rev 11046) +++ trunk/octave-forge/main/statistics/inst/linkage.m 2012-09-18 15:23:21 UTC (rev 11047) @@ -23,7 +23,7 @@ ## ## Produce a hierarchical clustering dendrogram ## -## @var{d} is the dissimilarity matrix relative to @var{n} observations, +## @var{d} is the dissimilarity matrix relative to n observations, ## formatted as a @math{(n-1)*n/2}x1 vector as produced by @code{pdist}. ## Alternatively, @var{x} contains data formatted for input to ## @code{pdist}, @var{metric} is a metric for @code{pdist} and @@ -31,11 +31,11 @@ ## @code{pdist}. ## ## @code{linkage} starts by putting each observation into a singleton -## cluster and numbering those from 1 to @var{n}. Then it merges two +## cluster and numbering those from 1 to n. Then it merges two ## clusters, chosen according to @var{method}, to create a new cluster -## numbered @var{n+1}, and so on until all observations are grouped into -## a single cluster numbered @var{2*n-1}. Row @var{m} of the -## @math{m-1}x3 output matrix relates to cluster @math{n+m}: the first +## numbered n+1, and so on until all observations are grouped into +## a single cluster numbered 2*n-1. Row m of the +## (m-1)x3 output matrix relates to cluster n+m: the first ## two columns are the numbers of the two component clusters and column ## 3 contains their distance. ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-18 06:25:36
|
Revision: 11046 http://octave.svn.sourceforge.net/octave/?rev=11046&view=rev Author: paramaniac Date: 2012-09-18 06:25:30 +0000 (Tue, 18 Sep 2012) Log Message: ----------- control: quicksave time response draft code Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-18 05:58:35 UTC (rev 11045) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-18 06:25:30 UTC (rev 11046) @@ -128,12 +128,15 @@ case "initial" str = "Response to Initial Conditions"; cols = 1; + yfinal = zeros (p, 1); case "step" str = "Step Response"; cols = m; + yfinal = dcgain (sys_cell{1}); case "impulse" str = "Impulse Response"; cols = m; + yfinal = zeros (p, m); otherwise error ("time_response: invalid response type"); endswitch @@ -170,7 +173,12 @@ for i = 1 : p # for every output for j = 1 : cols # for every input (except for initial where cols=1) subplot (p, cols, (i-1)*cols+j); - plot (t{k}, y{k}(:, i, j), style{:}); + if (n_sys == 1 && isstable (sys_cell{1})) + plot (t{k}, y{k}(:, i, j), style{:}, [t{k}(1), t{k}(end)], repmat (yfinal(i,j), 1, 2)); + ## TODO: plot final value first such that its line doesn't overprint the response + else + plot (t{k}, y{k}(:, i, j), style{:}); + endif hold on; grid on; if (k == n_sys) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-18 05:58:41
|
Revision: 11045 http://octave.svn.sourceforge.net/octave/?rev=11045&view=rev Author: paramaniac Date: 2012-09-18 05:58:35 +0000 (Tue, 18 Sep 2012) Log Message: ----------- control: print legend with system names Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m trunk/octave-forge/main/control/devel/step2.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-18 05:41:47 UTC (rev 11044) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-18 05:58:35 UTC (rev 11045) @@ -23,7 +23,7 @@ ## Version: 0.3 % function [y, t, x_arr] = __time_response_2__ (sys, resptype, plotflag, tfinal, dt, x0, sysname) -function [y, t, x] = __time_response_2__ (resptype, args, plotflag) +function [y, t, x] = __time_response_2__ (resptype, args, sysname, plotflag) sys_idx = cellfun (@isa, args, {"lti"}); # look for LTI models sys_cell = cellfun (@ss, args(sys_idx), "uniformoutput", false); # convert to state-space @@ -188,6 +188,9 @@ endif endfor xlabel ("Time [s]"); + if (p == 1 && m == 1) + legend (sysname) + endif hold off; endif Modified: trunk/octave-forge/main/control/devel/step2.m =================================================================== --- trunk/octave-forge/main/control/devel/step2.m 2012-09-18 05:41:47 UTC (rev 11044) +++ trunk/octave-forge/main/control/devel/step2.m 2012-09-18 05:58:35 UTC (rev 11045) @@ -62,14 +62,23 @@ if (nargin == 0) print_usage (); endif - - %tmp = cellfun (@isa, varargin, {"lti"}); - %sys_idx = find (tmp); - - %sys_names = arrayfun (@inputname, sys_idx); + if (nargout) + sysname = {}; + else + sys_idx = find (cellfun (@isa, varargin, {"lti"})); + len = length (sys_idx); + sysname = cell (len, 1); + for k = 1 : len + try + sysname{k} = inputname(sys_idx(k)); + catch + sysname{k} = ""; + end_try_catch + endfor + endif - [y, t, x] = __time_response_2__ ("step", varargin, ! nargout); + [y, t, x] = __time_response_2__ ("step", varargin, sysname, ! nargout); if (nargout) y_r = y{1}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-18 05:41:53
|
Revision: 11044 http://octave.svn.sourceforge.net/octave/?rev=11044&view=rev Author: paramaniac Date: 2012-09-18 05:41:47 +0000 (Tue, 18 Sep 2012) Log Message: ----------- control: use colororder Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-18 04:09:40 UTC (rev 11043) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-18 05:41:47 UTC (rev 11044) @@ -140,14 +140,18 @@ outname = get (sys_cell{end}, "outname"); outname = __labels__ (outname, "y"); + colororder = get (gca, "colororder"); + rc = rows (colororder); for k = 1 : n_sys # for every system + color = colororder(1+rem (k-1, rc), :); + style = {"-", "color", color}; discrete = ! ct_idx(k); if (discrete) # discrete-time system for i = 1 : p # for every output for j = 1 : cols # for every input (except for initial where cols=1) subplot (p, cols, (i-1)*cols+j); - stairs (t{k}, y{k}(:, i, j)); + stairs (t{k}, y{k}(:, i, j), style{:}); hold on; grid on; if (k == n_sys) @@ -166,7 +170,7 @@ for i = 1 : p # for every output for j = 1 : cols # for every input (except for initial where cols=1) subplot (p, cols, (i-1)*cols+j); - plot (t{k}, y{k}(:, i, j)); + plot (t{k}, y{k}(:, i, j), style{:}); hold on; grid on; if (k == n_sys) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-18 04:09:46
|
Revision: 11043 http://octave.svn.sourceforge.net/octave/?rev=11043&view=rev Author: paramaniac Date: 2012-09-18 04:09:40 +0000 (Tue, 18 Sep 2012) Log Message: ----------- control: style fixes Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-18 00:05:50 UTC (rev 11042) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-18 04:09:40 UTC (rev 11043) @@ -25,8 +25,8 @@ % function [y, t, x_arr] = __time_response_2__ (sys, resptype, plotflag, tfinal, dt, x0, sysname) function [y, t, x] = __time_response_2__ (resptype, args, plotflag) - sys_idx = cellfun (@isa, args, {"lti"}); # look for LTI models - sys_cell = cellfun (@ss, args(sys_idx), "uniformoutput", false); # convert to state-space + sys_idx = cellfun (@isa, args, {"lti"}); # look for LTI models + sys_cell = cellfun (@ss, args(sys_idx), "uniformoutput", false); # convert to state-space if (! size_equal (sys_cell{:})) error ("%s: models must have equal sizes", resptype); @@ -63,18 +63,18 @@ %{ if (! isa (sys, "ss")) - sys = ss (sys); # sys must be proper + sys = ss (sys); # sys must be proper endif - if (is_real_vector (tfinal) && length (tfinal) > 1) # time vector t passed - dt = tfinal(2) - tfinal(1); # assume that t is regularly spaced + if (is_real_vector (tfinal) && length (tfinal) > 1) # time vector t passed + dt = tfinal(2) - tfinal(1); # assume that t is regularly spaced tfinal = tfinal(end); endif [A, B, C, D, tsam] = ssdata (sys); - discrete = ! isct (sys); # static gains are treated as analog systems - tsam = abs (tsam); # use 1 second if tsam is unspecified (-1) + discrete = ! isct (sys); # static gains are treated as analog systems + tsam = abs (tsam); # use 1 second if tsam is unspecified (-1) if (discrete) if (! isempty (dt)) @@ -90,11 +90,11 @@ sys = c2d (sys, dt, "zoh"); endif - [F, G] = ssdata (sys); # matrices C and D don't change + [F, G] = ssdata (sys); # matrices C and D don't change - n = rows (F); # number of states - m = columns (G); # number of inputs - p = rows (C); # number of outputs + n = rows (F); # number of states + m = columns (G); # number of inputs + p = rows (C); # number of outputs ## time vector t = reshape (0 : dt : tfinal, [], 1); @@ -122,7 +122,7 @@ endswitch - if (plotflag) # display plot + if (plotflag) # display plot [p, m] = size (sys_cell{1}); switch (resptype) case "initial" @@ -141,40 +141,40 @@ outname = get (sys_cell{end}, "outname"); outname = __labels__ (outname, "y"); - for i = 1 : n_sys - discrete = ! ct_idx(i); - if (discrete) # discrete-time system - for k = 1 : p - for j = 1 : cols - subplot (p, cols, (k-1)*cols+j); - stairs (t{i}, y{i}(:, k, j)); + for k = 1 : n_sys # for every system + discrete = ! ct_idx(k); + if (discrete) # discrete-time system + for i = 1 : p # for every output + for j = 1 : cols # for every input (except for initial where cols=1) + subplot (p, cols, (i-1)*cols+j); + stairs (t{k}, y{k}(:, i, j)); hold on; grid on; - if (i == n_sys) + if (k == n_sys) axis tight; ylim (__axis_margin__ (ylim)) if (j == 1) - ylabel (outname{k}); - if (k == 1) + ylabel (outname{i}); + if (i == 1) title (str); endif endif endif endfor endfor - else # continuous-time system - for k = 1 : p - for j = 1 : cols - subplot (p, cols, (k-1)*cols+j); - plot (t{i}, y{i}(:, k, j)); + else # continuous-time system + for i = 1 : p # for every output + for j = 1 : cols # for every input (except for initial where cols=1) + subplot (p, cols, (i-1)*cols+j); + plot (t{k}, y{k}(:, i, j)); hold on; grid on; - if (i == n_sys) + if (k == n_sys) axis tight ylim (__axis_margin__ (ylim)) if (j == 1) - ylabel (outname{k}); - if (k == 1) + ylabel (outname{i}); + if (i == 1) title (str); endif endif @@ -194,11 +194,11 @@ function [y, x_arr] = __initial_response__ (sys_dt, t, x0) - [F, G, C, D] = ssdata (sys_dt); # system must be proper + [F, G, C, D] = ssdata (sys_dt); # system must be proper - n = rows (F); # number of states - m = columns (G); # number of inputs - p = rows (C); # number of outputs + n = rows (F); # number of states + m = columns (G); # number of inputs + p = rows (C); # number of outputs l_t = length (t); ## preallocate memory @@ -206,7 +206,7 @@ x_arr = zeros (l_t, n); ## initial conditions - x = reshape (x0, [], 1); # make sure that x is a column vector + x = reshape (x0, [], 1); # make sure that x is a column vector if (n != length (x0) || ! is_real_vector (x0)) error ("initial: x0 must be a real vector with %d elements", n); @@ -226,16 +226,16 @@ [F, G, C, D] = ssdata (sys_dt); # system must be proper - n = rows (F); # number of states - m = columns (G); # number of inputs - p = rows (C); # number of outputs + n = rows (F); # number of states + m = columns (G); # number of inputs + p = rows (C); # number of outputs l_t = length (t); ## preallocate memory y = zeros (l_t, p, m); x_arr = zeros (l_t, n, m); - for j = 1 : m # for every input channel + for j = 1 : m # for every input channel ## initial conditions x = zeros (n, 1); u = zeros (m, 1); @@ -255,30 +255,30 @@ function [y, x_arr] = __impulse_response__ (sys, sys_dt, t) [~, B] = ssdata (sys); - [F, G, C, D, dt] = ssdata (sys_dt); # system must be proper + [F, G, C, D, dt] = ssdata (sys_dt); # system must be proper discrete = ! isct (sys); - n = rows (F); # number of states - m = columns (G); # number of inputs - p = rows (C); # number of outputs + n = rows (F); # number of states + m = columns (G); # number of inputs + p = rows (C); # number of outputs l_t = length (t); ## preallocate memory y = zeros (l_t, p, m); x_arr = zeros (l_t, n, m); - for j = 1 : m # for every input channel + for j = 1 : m # for every input channel ## initial conditions u = zeros (m, 1); u(j) = 1; if (discrete) - x = zeros (n, 1); # zero by definition + x = zeros (n, 1); # zero by definition y(1, :, j) = D * u / dt; x_arr(1, :, j) = x; x = G * u / dt; else - x = B * u; # B, not G! + x = B * u; # B, not G! y(1, :, j) = C * x; x_arr(1, :, j) = x; x = F * x; @@ -306,14 +306,14 @@ ## code based on __stepimp__.m of Kai P. Mueller and A. Scottedward Hodel - TOL = 1.0e-10; # values below TOL are assumed to be zero - N_MIN = 50; # min number of points - N_MAX = 2000; # max number of points - N_DEF = 1000; # default number of points - T_DEF = 10; # default simulation time + TOL = 1.0e-10; # values below TOL are assumed to be zero + N_MIN = 50; # min number of points + N_MAX = 2000; # max number of points + N_DEF = 1000; # default number of points + T_DEF = 10; # default simulation time ev = pole (sys); - n = length (ev); # number of states/poles + n = length (ev); # number of states/poles continuous = isct (sys); discrete = ! continuous; Ts = get (sys, "tsam"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-09-18 00:05:57
|
Revision: 11042 http://octave.svn.sourceforge.net/octave/?rev=11042&view=rev Author: carandraug Date: 2012-09-18 00:05:50 +0000 (Tue, 18 Sep 2012) Log Message: ----------- regionprops: alphabetic order of options in help text Modified Paths: -------------- trunk/octave-forge/main/image/inst/regionprops.m Modified: trunk/octave-forge/main/image/inst/regionprops.m =================================================================== --- trunk/octave-forge/main/image/inst/regionprops.m 2012-09-17 20:17:18 UTC (rev 11041) +++ trunk/octave-forge/main/image/inst/regionprops.m 2012-09-18 00:05:50 UTC (rev 11042) @@ -23,71 +23,87 @@ ## identified by @code{bwlabel}) in the binary image @var{BW}. The result is a ## structure array containing an entry per property per object. ## -## The following properties can be computed. +## The following properties can be computed: ## -## @table @t +## @table @asis ## @item "Area" ## The number of pixels in the object. -## @item "EulerNumber" -## @itemx "euler_number" -## The Euler number of the object (see @code{bweuler} for details). +## ## @item "BoundingBox" ## @itemx "bounding_box" ## The bounding box of the object. This is represented as a 4-vector where the ## first two entries are the @math{x} and @math{y} coordinates of the upper left ## corner of the bounding box, and the two last entries are the width and the ## height of the box. +## +## @item "Centroid" +## The center coordinate of the object. +## +## @item "EulerNumber" +## @itemx "euler_number" +## The Euler number of the object (see @code{bweuler} for details). +## ## @item "Extent" ## The area of the object divided by the area of the bounding box. -## @item "Perimeter" -## The length of the boundary of the object. -## @item "Centroid" -## The center coordinate of the object. -## @item "PixelIdxList" -## @itemx "pixel_idx_list" -## The indices of the pixels in the object. +## ## @item "FilledArea" ## @itemx "filled_area" ## The area of the object including possible holes. -## @item "PixelList" -## @itemx "pixel_list" -## The actual pixel values inside the object. This is only useful for grey scale -## images. +## ## @item "FilledImage" ## @itemx "filled_image" ## A binary image with the same size as the object's bounding box that contains ## the object with all holes removed. +## ## @item "Image" ## An image with the same size as the bounding box that contains the original pixels. +## ## @item "MaxIntensity" ## @itemx "max_intensity" ## The maximum intensity inside the object. +## +## @item "MeanIntensity" +## @itemx "mean_intensity" +## The mean intensity inside the object. +## ## @item "MinIntensity" ## @itemx "min_intensity" ## The minimum intensity inside the object. +## +## @item "Perimeter" +## The length of the boundary of the object. +## +## @item "PixelIdxList" +## @itemx "pixel_idx_list" +## The indices of the pixels in the object. +## +## @item "PixelList" +## @itemx "pixel_list" +## The actual pixel values inside the object. This is only useful for grey scale +## images. +## +## @item "PixelValues" +## @itemx "pixel_values" +## The pixel values inside the object represented as a vector. +## ## @item "WeightedCentroid" ## @itemx "weighted_centroid" ## The centroid of the object where pixel values are used as weights. -## @item "MeanIntensity" -## @itemx "mean_intensity" -## The mean intensity inside the object. -## @item "PixelValues" -## @itemx "pixel_values" -## The pixel values inside the object represented as a vector. ## @end table ## ## The requested properties can either be specified as several input arguments ## or as a cell array of strings. As a short-hand it is also possible to give ## the following strings as arguments. ## -## @table @t +## @table @asis ## @item "basic" -## The following properties are computed: @t{"Area"}, @t{"Centroid"} and @t{"BoundingBox"}. +## The following properties are computed: @t{"Area"}, @t{"Centroid"} and +## @t{"BoundingBox"}. This is the default. +## ## @item "all" ## All properties are computed. ## @end table ## -## If no properties are given, @t{basic} is assumed. ## @seealso{bwlabel, bwperim, bweuler} ## @end deftypefn @@ -345,4 +361,3 @@ C = [C; C]; endif 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-09-17 20:17:24
|
Revision: 11041 http://octave.svn.sourceforge.net/octave/?rev=11041&view=rev Author: paramaniac Date: 2012-09-17 20:17:18 +0000 (Mon, 17 Sep 2012) Log Message: ----------- control: tighten axes Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m trunk/octave-forge/main/control/devel/multiplot2.m trunk/octave-forge/main/control/devel/multiplot3.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-17 15:09:54 UTC (rev 11040) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-17 20:17:18 UTC (rev 11041) @@ -34,8 +34,8 @@ tmp = cellfun (@is_real_matrix, args); vec_idx = find (tmp); - n_vec = length (vec_idx) - n_sys = length (sys_cell) + n_vec = length (vec_idx); + n_sys = length (sys_cell); %if (n_vec >= 1) % arg = args{vec_idx(1)}; @@ -47,14 +47,14 @@ tfinal = []; dt = {[]}; - [tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, dt, "uniformoutput", false); + %[tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, dt, "uniformoutput", false); + + [tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, "uniformoutput", false); tfinal = max ([tfinal{:}]); - % __sim_horizon__ (sys, tfinal, dt); - - - %hier sim_horizon +dt + ct_idx = cellfun (@isct, sys_cell); sys_dt_cell = sys_cell; @@ -143,34 +143,42 @@ for i = 1 : n_sys discrete = ! ct_idx(i); - if (discrete) # discrete system + if (discrete) # discrete-time system for k = 1 : p for j = 1 : cols subplot (p, cols, (k-1)*cols+j); stairs (t{i}, y{i}(:, k, j)); hold on; - grid ("on"); - if (i == n_sys && k == 1 && j == 1) - title (str); + grid on; + if (i == n_sys) + axis tight; + ylim (__axis_margin__ (ylim)) + if (j == 1) + ylabel (outname{k}); + if (k == 1) + title (str); + endif + endif endif - if (i == n_sys && j == 1) - ylabel (outname{k}); - endif endfor endfor - else # continuous system + else # continuous-time system for k = 1 : p for j = 1 : cols subplot (p, cols, (k-1)*cols+j); plot (t{i}, y{i}(:, k, j)); hold on; - grid ("on"); - if (i == n_sys && k == 1 && j == 1) - title (str); + grid on; + if (i == n_sys) + axis tight + ylim (__axis_margin__ (ylim)) + if (j == 1) + ylabel (outname{k}); + if (k == 1) + title (str); + endif + endif endif - if (i == n_sys && j == 1) - ylabel (outname{k}); - endif endfor endfor endif @@ -305,8 +313,10 @@ T_DEF = 10; # default simulation time ev = pole (sys); - n = length (ev); - discrete = ! isct (sys); + n = length (ev); # number of states/poles + continuous = isct (sys); + discrete = ! continuous; + Ts = get (sys, "tsam"); if (discrete) ## perform bilinear transformation on poles in z @@ -334,14 +344,14 @@ tfinal = T_DEF; endif - if (! discrete) + if (continuous) dt = tfinal / N_DEF; endif else ev = ev(find (ev)); ev_max = max (abs (ev)); - if (! discrete) + if (continuous) dt = 0.2 * pi / ev_max; endif @@ -354,7 +364,7 @@ tfinal = yy * ceil (tfinal / yy); endif - if (! discrete) + if (continuous) N = tfinal / dt; if (N < N_MIN) @@ -367,8 +377,8 @@ endif endif - if (! isempty (Ts)) # catch case cont. system with dt specified - dt = Ts; - endif + %if (! isempty (Ts)) # catch case cont. system with dt specified + % dt = Ts; + %endif endfunction Modified: trunk/octave-forge/main/control/devel/multiplot2.m =================================================================== --- trunk/octave-forge/main/control/devel/multiplot2.m 2012-09-17 15:09:54 UTC (rev 11040) +++ trunk/octave-forge/main/control/devel/multiplot2.m 2012-09-17 20:17:18 UTC (rev 11041) @@ -72,7 +72,6 @@ Kr4 = spaconred (P, K, 4, 'feedback', '-') Kr2 = spaconred (P, K, 2, 'feedback', '-') -%{ % Open Loop L = P * K; Lr4 = P * Kr4; @@ -82,7 +81,6 @@ T = feedback (L); Tr4 = feedback (Lr4); Tr2 = feedback (Lr2); -%} % Frequency Range w = {1e-2, 1e1}; @@ -94,6 +92,10 @@ % title ('Bode Diagrams of K and Kr') legend ('K (8 states)', 'Kr (4 states)', 'Kr (2 states)', 'location', 'southwest') +% Step Response of Closed Loop +figure (2) +step2 (T, Tr4, Tr2) + %{ % Step Response of Closed Loop [y, t] = step (T, 100); Modified: trunk/octave-forge/main/control/devel/multiplot3.m =================================================================== --- trunk/octave-forge/main/control/devel/multiplot3.m 2012-09-17 15:09:54 UTC (rev 11040) +++ trunk/octave-forge/main/control/devel/multiplot3.m 2012-09-17 20:17:18 UTC (rev 11041) @@ -2,3 +2,7 @@ figure (1) step2 (T_AH, T_opt) + + +figure (2) +step2 (T_AH, c2d (T_opt, 1)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-17 15:10:05
|
Revision: 11040 http://octave.svn.sourceforge.net/octave/?rev=11040&view=rev Author: paramaniac Date: 2012-09-17 15:09:54 +0000 (Mon, 17 Sep 2012) Log Message: ----------- control: get draft code for multiplot step response working Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m trunk/octave-forge/main/control/devel/step2.m Added Paths: ----------- trunk/octave-forge/main/control/devel/multiplot3.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-17 05:51:45 UTC (rev 11039) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-17 15:09:54 UTC (rev 11040) @@ -23,10 +23,10 @@ ## Version: 0.3 % function [y, t, x_arr] = __time_response_2__ (sys, resptype, plotflag, tfinal, dt, x0, sysname) -function [y, t, x] = __time_response_2__ (resptype, args) +function [y, t, x] = __time_response_2__ (resptype, args, plotflag) sys_idx = cellfun (@isa, args, {"lti"}); # look for LTI models - sys_cell = cellfun (@ss, args(sys_idx)); # system must be proper + sys_cell = cellfun (@ss, args(sys_idx), "uniformoutput", false); # convert to state-space if (! size_equal (sys_cell{:})) error ("%s: models must have equal sizes", resptype); @@ -37,25 +37,28 @@ n_vec = length (vec_idx) n_sys = length (sys_cell) - if (n_vec >= 1) - arg = args{vec_idx(1)}; - - endif + %if (n_vec >= 1) + % arg = args{vec_idx(1)}; + % + %endif ## extract tfinal/t, dt, x0 - [tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, dt); + tfinal = []; + dt = {[]}; + + [tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, dt, "uniformoutput", false); - tfinal = max (tfinal); + tfinal = max ([tfinal{:}]); % __sim_horizon__ (sys, tfinal, dt); - hier sim_horizon + %hier sim_horizon - ct_idx = cellfun (@isct, sys_cell) + ct_idx = cellfun (@isct, sys_cell); sys_dt_cell = sys_cell; - tmp = (@c2d, sys_cell(ct_idx), dt, {"zoh"}, "uniformoutput", false) + tmp = cellfun (@c2d, sys_cell(ct_idx), dt, {"zoh"}, "uniformoutput", false); sys_dt_cell(ct_idx) = tmp; %{ @@ -98,13 +101,18 @@ l_t = length (t); %} + + ## time vector + t = @cellfun (@(dt) reshape (0 : dt : tfinal, [], 1), dt, "uniformoutput", false); + + %function [y, x_arr] = __initial_response__ (sys, sys_dt, t, x0) %function [y, x_arr] = __step_response__ (sys_dt, t) %function [y, x_arr] = __impulse_response__ (sys, sys_dt, t) switch (resptype) case "initial" - [y, x] = cellfun (@__initial_response__, sys_dt_cell, t, {x0} or x0, "uniformoutput", false); + %[y, x] = cellfun (@__initial_response__, sys_dt_cell, t, {x0} or x0, "uniformoutput", false); case "step" [y, x] = cellfun (@__step_response__, sys_dt_cell, t, "uniformoutput", false); case "impulse" @@ -114,9 +122,8 @@ endswitch - - if (plotflag) # display plot + [p, m] = size (sys_cell{1}); switch (resptype) case "initial" str = "Response to Initial Conditions"; @@ -130,23 +137,24 @@ otherwise error ("time_response: invalid response type"); endswitch + + outname = get (sys_cell{end}, "outname"); + outname = __labels__ (outname, "y"); for i = 1 : n_sys - t = t{i}; - y = y{i}; discrete = ! ct_idx(i); if (discrete) # discrete system for k = 1 : p for j = 1 : cols subplot (p, cols, (k-1)*cols+j); - stairs (t, y(:, k, j)); + stairs (t{i}, y{i}(:, k, j)); hold on; grid ("on"); if (i == n_sys && k == 1 && j == 1) title (str); endif if (i == n_sys && j == 1) - ylabel (sprintf ("Amplitude %s", outname{k})); + ylabel (outname{k}); endif endfor endfor @@ -154,14 +162,14 @@ for k = 1 : p for j = 1 : cols subplot (p, cols, (k-1)*cols+j); - plot (t, y(:, k, j)); + plot (t{i}, y{i}(:, k, j)); hold on; grid ("on"); if (i == n_sys && k == 1 && j == 1) title (str); endif if (i == n_sys && j == 1) - ylabel (sprintf ("Amplitude %s", outname{k})); + ylabel (outname{k}); endif endfor endfor @@ -171,89 +179,14 @@ hold off; endif -%{ - if (plotflag) # display plot - - ## TODO: Set correct titles, especially for multi-input systems - - stable = isstable (sys); - outname = get (sys, "outname"); - outname = __labels__ (outname, "y_"); - - if (strcmp (resptype, "initial")) - cols = 1; - else - cols = m; - endif - - if (discrete) # discrete system - for k = 1 : p - for j = 1 : cols - - subplot (p, cols, (k-1)*cols+j); - - if (stable) - stairs (t, [y(:, k, j), yfinal(k, j) * ones(l_t, 1)]); - else - stairs (t, y(:, k, j)); - endif - - grid ("on"); - - if (k == 1 && j == 1) - title (str); - endif - - if (j == 1) - ylabel (sprintf ("Amplitude %s", outname{k})); - endif - - endfor - endfor - - xlabel ("Time [s]"); - - else # continuous system - for k = 1 : p - for j = 1 : cols - - subplot (p, cols, (k-1)*cols+j); - - if (stable) - plot (t, [y(:, k, j), yfinal(k, j) * ones(l_t, 1)]); - else - plot (t, y(:, k, j)); - endif - - grid ("on"); - - if (k == 1 && j == 1) - title (str); - endif - - if (j == 1) - ylabel (sprintf ("Amplitude %s", outname{k})); - endif - - endfor - endfor - - xlabel ("Time [s]"); - - endif - endif - endfunction -%} -endfunction - function [y, x_arr] = __initial_response__ (sys_dt, t, x0) - [F, G, C, D] = ssdata (sys_dt); + [F, G, C, D] = ssdata (sys_dt); # system must be proper n = rows (F); # number of states m = columns (G); # number of inputs @@ -283,7 +216,7 @@ function [y, x_arr] = __step_response__ (sys_dt, t) - [F, G, C, D] = ssdata (sys_dt); + [F, G, C, D] = ssdata (sys_dt); # system must be proper n = rows (F); # number of states m = columns (G); # number of inputs @@ -313,8 +246,8 @@ function [y, x_arr] = __impulse_response__ (sys, sys_dt, t) - [~, B, ~, ~, dt] = ssdata (sys); - [F, G, C, D] = ssdata (sys_dt); + [~, B] = ssdata (sys); + [F, G, C, D, dt] = ssdata (sys_dt); # system must be proper discrete = ! isct (sys); n = rows (F); # number of states @@ -359,10 +292,7 @@ endfunction -function - - % function [tfinal, dt] = __sim_horizon__ (A, discrete, tfinal, Ts) function [tfinal, dt] = __sim_horizon__ (sys, tfinal, Ts) @@ -376,6 +306,7 @@ ev = pole (sys); n = length (ev); + discrete = ! isct (sys); if (discrete) ## perform bilinear transformation on poles in z Added: trunk/octave-forge/main/control/devel/multiplot3.m =================================================================== --- trunk/octave-forge/main/control/devel/multiplot3.m (rev 0) +++ trunk/octave-forge/main/control/devel/multiplot3.m 2012-09-17 15:09:54 UTC (rev 11040) @@ -0,0 +1,4 @@ +load tfs.dat + +figure (1) +step2 (T_AH, T_opt) Modified: trunk/octave-forge/main/control/devel/step2.m =================================================================== --- trunk/octave-forge/main/control/devel/step2.m 2012-09-17 05:51:45 UTC (rev 11039) +++ trunk/octave-forge/main/control/devel/step2.m 2012-09-17 15:09:54 UTC (rev 11040) @@ -69,7 +69,7 @@ %sys_names = arrayfun (@inputname, sys_idx); - [y, t, x] = __time_response__ ("step", varargin, ! nargout); + [y, t, x] = __time_response_2__ ("step", varargin, ! nargout); if (nargout) y_r = y{1}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-17 05:51:51
|
Revision: 11039 http://octave.svn.sourceforge.net/octave/?rev=11039&view=rev Author: paramaniac Date: 2012-09-17 05:51:45 +0000 (Mon, 17 Sep 2012) Log Message: ----------- control: touch up time response draft code Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-16 22:39:23 UTC (rev 11038) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-17 05:51:45 UTC (rev 11039) @@ -104,11 +104,11 @@ switch (resptype) case "initial" - [y, x] = cellfun (@__initial_response__, sys_cell, sys_dt_cell, t, {x0} or x0); + [y, x] = cellfun (@__initial_response__, sys_dt_cell, t, {x0} or x0, "uniformoutput", false); case "step" - [y, x] = cellfun (@__step_response__, sys_dt_cell, t); + [y, x] = cellfun (@__step_response__, sys_dt_cell, t, "uniformoutput", false); case "impulse" - [y, x] = cellfun (@__impulse_response__, sys_cell, sys_dt_cell, t); + [y, x] = cellfun (@__impulse_response__, sys_cell, sys_dt_cell, t, "uniformoutput", false); otherwise error ("time_response: invalid response type"); endswitch @@ -251,10 +251,9 @@ -function [y, x_arr] = __initial_response__ (sys, sys_dt, t, x0) +function [y, x_arr] = __initial_response__ (sys_dt, t, x0) - [A, B, C, D] = ssdata (sys); - [F, G] = ssdata (sys_dt); + [F, G, C, D] = ssdata (sys_dt); n = rows (F); # number of states m = columns (G); # number of inputs @@ -314,8 +313,8 @@ function [y, x_arr] = __impulse_response__ (sys, sys_dt, t) - [A, B, C, D, dt] = ssdata (sys); - [F, G] = ssdata (sys_dt); + [~, B, ~, ~, dt] = ssdata (sys); + [F, G, C, D] = ssdata (sys_dt); discrete = ! isct (sys); n = rows (F); # number of states This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-09-16 22:39:29
|
Revision: 11038 http://octave.svn.sourceforge.net/octave/?rev=11038&view=rev Author: carandraug Date: 2012-09-16 22:39:23 +0000 (Sun, 16 Sep 2012) Log Message: ----------- graythresh: consistent indentation Modified Paths: -------------- trunk/octave-forge/main/image/inst/graythresh.m Modified: trunk/octave-forge/main/image/inst/graythresh.m =================================================================== --- trunk/octave-forge/main/image/inst/graythresh.m 2012-09-16 22:37:02 UTC (rev 11037) +++ trunk/octave-forge/main/image/inst/graythresh.m 2012-09-16 22:39:23 UTC (rev 11038) @@ -91,58 +91,58 @@ ## added texinfo documentation, error checking and sanitised the code. function [level, goodness] = graythresh (img, algo = "otsu") - ## Input checking - if (nargin < 1 || nargin > 2) - print_usage(); - elseif (!isgray (img) && !isrgb (img)) - error ("graythresh: input must be an image"); - endif + ## Input checking + if (nargin < 1 || nargin > 2) + print_usage(); + elseif (!isgray (img) && !isrgb (img)) + error ("graythresh: input must be an image"); + endif - ## If the image is RGB convert it to grayscale - if (isrgb (img)) - img = rgb2gray (img); - endif + ## If the image is RGB convert it to grayscale + if (isrgb (img)) + img = rgb2gray (img); + endif - switch tolower (algo) - case {"otsu"} - ## Calculation of the normalized histogram - n = double (intmax (class (img))) + 1; - h = hist (img(:), 1:n); - h = h / (length (img(:)) + 1); + switch tolower (algo) + case {"otsu"} + ## Calculation of the normalized histogram + n = double (intmax (class (img))) + 1; + h = hist (img(:), 1:n); + h = h / (length (img(:)) + 1); - ## Calculation of the cumulated histogram and the mean values - w = cumsum (h); - mu = zeros (n, 1); - mu(1) = h(1); - for i = 2:n - mu(i) = mu(i-1) + i * h(i); - endfor + ## Calculation of the cumulated histogram and the mean values + w = cumsum (h); + mu = zeros (n, 1); + mu(1) = h(1); + for i = 2:n + mu(i) = mu(i-1) + i * h(i); + endfor - ## Initialisation of the values used for the threshold calculation - level = find (h > 0, 1); - w0 = w(level); - w1 = 1 - w0; - mu0 = mu(level) / w0; - mu1 = (mu(end) - mu(level)) / w1; - goodness = w0 * w1 * (mu1 - mu0) * (mu1 - mu0); - - ## For each step of the histogram, calculation of the threshold - ## and storing of the maximum - for i = find (h > 0) - w0 = w(i); - w1 = 1 - w0; - mu0 = mu(i) / w0; - mu1 = (mu(end) - mu(i)) / w1; - s = w0 * w1 * (mu1 - mu0) * (mu1 - mu0); - if (s > goodness) - goodness = s; - level = i; - endif - endfor + ## Initialisation of the values used for the threshold calculation + level = find (h > 0, 1); + w0 = w(level); + w1 = 1 - w0; + mu0 = mu(level) / w0; + mu1 = (mu(end) - mu(level)) / w1; + goodness = w0 * w1 * (mu1 - mu0) * (mu1 - mu0); + + ## For each step of the histogram, calculation of the threshold + ## and storing of the maximum + for i = find (h > 0) + w0 = w(i); + w1 = 1 - w0; + mu0 = mu(i) / w0; + mu1 = (mu(end) - mu(i)) / w1; + s = w0 * w1 * (mu1 - mu0) * (mu1 - mu0); + if (s > goodness) + goodness = s; + level = i; + endif + endfor - ## Normalisation of the threshold - level /= n; - otherwise - error ("graythresh: unknown method '%s'", algo); - endswitch + ## Normalisation of the threshold + level /= n; + otherwise + error ("graythresh: unknown method '%s'", algo); + endswitch endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-09-16 22:37:08
|
Revision: 11037 http://octave.svn.sourceforge.net/octave/?rev=11037&view=rev Author: carandraug Date: 2012-09-16 22:37:02 +0000 (Sun, 16 Sep 2012) Log Message: ----------- graythresh: fix bug because intmax does not return double and wrongly named var Modified Paths: -------------- trunk/octave-forge/main/image/inst/graythresh.m Modified: trunk/octave-forge/main/image/inst/graythresh.m =================================================================== --- trunk/octave-forge/main/image/inst/graythresh.m 2012-09-16 17:47:16 UTC (rev 11036) +++ trunk/octave-forge/main/image/inst/graythresh.m 2012-09-16 22:37:02 UTC (rev 11037) @@ -99,14 +99,14 @@ endif ## If the image is RGB convert it to grayscale - if (isrgb(img)) + if (isrgb (img)) img = rgb2gray (img); endif switch tolower (algo) case {"otsu"} ## Calculation of the normalized histogram - n = intmax (class (img)) + 1; + n = double (intmax (class (img))) + 1; h = hist (img(:), 1:n); h = h / (length (img(:)) + 1); @@ -115,7 +115,7 @@ mu = zeros (n, 1); mu(1) = h(1); for i = 2:n - mu(i) = mu(i-1) + i * h(i); + mu(i) = mu(i-1) + i * h(i); endfor ## Initialisation of the values used for the threshold calculation @@ -134,12 +134,12 @@ mu0 = mu(i) / w0; mu1 = (mu(end) - mu(i)) / w1; s = w0 * w1 * (mu1 - mu0) * (mu1 - mu0); - if (s > max) + if (s > goodness) goodness = s; level = i; endif endfor - + ## Normalisation of the threshold level /= n; otherwise This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-16 17:47:22
|
Revision: 11036 http://octave.svn.sourceforge.net/octave/?rev=11036&view=rev Author: eandrius Date: 2012-09-16 17:47:16 +0000 (Sun, 16 Sep 2012) Log Message: ----------- instrument-control: i2c, fixed return value for i2c_read Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc 2012-09-16 17:08:22 UTC (rev 11035) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc 2012-09-16 17:47:16 UTC (rev 11036) @@ -14,6 +14,7 @@ // along with this program; if not, see <http://www.gnu.org/licenses/>. #include <octave/oct.h> +#include <octave/uint8NDArray.h> #include <stdio.h> #include <stdlib.h> @@ -64,15 +65,15 @@ retval = i2c->read(buffer, buffer_len); - octave_value_list return_list; - uint8NDArray data(retval); + octave_value_list return_list(2); + uint8NDArray data( dim_vector(1, retval) ); for (int i = 0; i < retval; i++) data(i) = buffer[i]; + return_list(0) = data; return_list(1) = retval; - return_list(0) = data; - + delete[] buffer; return return_list; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-16 17:08:28
|
Revision: 11035 http://octave.svn.sourceforge.net/octave/?rev=11035&view=rev Author: eandrius Date: 2012-09-16 17:08:22 +0000 (Sun, 16 Sep 2012) Log Message: ----------- instrument-control: serial, implemented interrupt signal and fixed return value for srl_read Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/serial/serial.cc trunk/octave-forge/main/instrument-control/src/serial/serial.h trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc Modified: trunk/octave-forge/main/instrument-control/src/serial/serial.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/serial.cc 2012-09-16 07:35:06 UTC (rev 11034) +++ trunk/octave-forge/main/instrument-control/src/serial/serial.cc 2012-09-16 17:08:22 UTC (rev 11035) @@ -112,6 +112,7 @@ unsigned short stopbits = 1; int oflags = O_RDWR | O_NOCTTY | O_SYNC; // O_SYNC - All writes immediately effective, no buffering + // O_NOCTTY - Don't make serial terminal the controlling terminal for the process if (!type_loaded) { @@ -172,11 +173,7 @@ } retval->set_baudrate(baud_rate); - - if (timeout >= 0) { - retval->set_timeout(timeout); - } - + retval->set_timeout(timeout); retval->set_parity(parity); retval->set_bytesize(bytesize); retval->set_stopbits(stopbits); Modified: trunk/octave-forge/main/instrument-control/src/serial/serial.h =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/serial.h 2012-09-16 07:35:06 UTC (rev 11034) +++ trunk/octave-forge/main/instrument-control/src/serial/serial.h 2012-09-16 17:08:22 UTC (rev 11035) @@ -37,7 +37,7 @@ int write(unsigned char*, int); int read(char *, unsigned int); - + int close(); int flush(unsigned short); @@ -79,7 +79,7 @@ int fd; struct termios config; - bool blocking_read; + volatile bool blocking_read; DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc 2012-09-16 07:35:06 UTC (rev 11034) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc 2012-09-16 17:08:22 UTC (rev 11035) @@ -61,11 +61,11 @@ int octave_serial::close() { - if (this->get_fd() < 0) + /*if (this->get_fd() < 0) { error("serial: Interface must be opened first..."); return -1; - } + }*/ int retval = ::close(this->get_fd()); this->fd = -1; Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc 2012-09-16 07:35:06 UTC (rev 11034) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc 2012-09-16 17:08:22 UTC (rev 11035) @@ -14,8 +14,8 @@ // along with this program; if not, see <http://www.gnu.org/licenses/>. #include <octave/oct.h> -#include <octave/ov-int32.h> -#include <octave/ov-uint8.h> +#include <octave/uint8NDArray.h> +#include <octave/sighandlers.h> #include <iostream> #include <string> @@ -34,8 +34,16 @@ #include "serial.h" +volatile bool read_interrupt = false; + +void read_sighandler(int sig) +{ + printf("srl_read: Interrupting...\n\r"); + read_interrupt = true; +} + DEFUN_DLD (srl_read, args, nargout, -"-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{data}, @var{count}] = } srl_read (@var{serial}, @var{n})\n \ \n\ Read from serial interface.\n \ @@ -46,28 +54,25 @@ The srl_read() shall return number of bytes successfully read in @var{count} as Integer and the bytes themselves in @var{data} as uint8 array.\n \ @end deftypefn") { - if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_serial::static_type_id()) + if (args.length() != 2 || args(0).type_id() != octave_serial::static_type_id()) { print_usage(); return octave_value(-1); } - char *buffer = NULL; - unsigned int buffer_len = 1; + unsigned int buffer_len = 0; - if (args.length() > 1) + if ( !(args(1).is_integer_type() || args(1).is_float_type()) ) { - if ( !(args(1).is_integer_type() || args(1).is_float_type()) ) - { - print_usage(); - return octave_value(-1); - } - - buffer_len = args(1).int_value(); + print_usage(); + return octave_value(-1); } - buffer = new char[buffer_len+1]; + buffer_len = args(1).int_value(); + char *buffer = NULL; + buffer = new char[buffer_len + 1]; + if (buffer == NULL) { error("srl_read: cannot allocate requested memory: %s\n", strerror(errno)); @@ -79,24 +84,26 @@ const octave_base_value& rep = args(0).get_rep(); serial = &((octave_serial &)rep); - int buffer_read = 0, read_retval = -1; + // Register custom interrupt signal handler + octave_set_signal_handler(SIGINT, read_sighandler); + read_interrupt = false; + + // Read data + int bytes_read = serial->read(buffer, buffer_len); - // While buffer not full and not timeout - while (buffer_read < buffer_len && read_retval != 0) - { - read_retval = serial->read(buffer + buffer_read, buffer_len - buffer_read); - buffer_read += read_retval; - } + // Restore default signal handling + // TODO: a better way? + install_signal_handlers(); - octave_value_list return_list; - uint8NDArray data(buffer_read); - - // TODO: clean this up - for (int i = 0; i < buffer_read; i++) + // Convert data to octave type variables + octave_value_list return_list(2); + uint8NDArray data( dim_vector(1, bytes_read) ); + + for (int i = 0; i < bytes_read; i++) data(i) = buffer[i]; - return_list(1) = buffer_read; return_list(0) = data; + return_list(1) = bytes_read; delete[] buffer; @@ -107,9 +114,38 @@ { if (this->get_fd() < 0) { - error("serial: Interface must be opened first..."); - return -1; + error("srl_read: Interface must be opened first..."); + return 0; } - - return ::read(get_fd(), buf, len); + + int bytes_read = 0, read_retval = -1; + + // While not interrupted in blocking mode + while (!read_interrupt) + { + read_retval = ::read(this->get_fd(), (void *)(buf + bytes_read), len - bytes_read); + //printf("read_retval: %d\n\r", read_retval); + + if (read_retval < 0) + { + error("srl_read: Error while reading: %s\n", strerror(errno)); + break; + } + + bytes_read += read_retval; + + // Required number of bytes read + if (bytes_read >= len) + break; + + // Timeout while in non-blocking mode + if (read_retval == 0 && !this->blocking_read) + break; + } + + return bytes_read; } + +/*int octave_serial::readline(char *buf, unsigned int len) +{ +}*/ Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc 2012-09-16 07:35:06 UTC (rev 11034) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc 2012-09-16 17:08:22 UTC (rev 11035) @@ -34,14 +34,14 @@ #include "serial.h" DEFUN_DLD (srl_timeout, args, nargout, -"-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} srl_timeout (@var{serial}, @var{timeout})\n \ @deftypefnx {Loadable Function} {@var{t} = } srl_timeout (@var{serial})\n \ \n\ Set new or get existing serial interface timeout parameter used for srl_read() requests. The timeout value is specified in tenths of a second.\n \ \n\ @var{serial} - instance of @var{octave_serial} class.@*\ -@var{timeout} - srl_read() timeout value in tenths of a second. Maximum value of 255 (i.e. 25.5 seconds).\n \ +@var{timeout} - srl_read() timeout value in tenths of a second. Value of -1 means a blocking call. Maximum value of 255 (i.e. 25.5 seconds).\n \ \n\ If @var{timeout} parameter is omitted, the srl_timeout() shall return current timeout value as the result @var{t}.\n \ @end deftypefn") @@ -51,7 +51,7 @@ print_usage(); return octave_value(-1); } - + octave_serial* serial = NULL; const octave_base_value& rep = args(0).get_rep(); @@ -82,36 +82,35 @@ error("serial: Interface must be opened first..."); return -1; } - - if (timeout < 0 || timeout > 255) + + if (timeout < -1 || timeout > 255) { - error("srl_timeout: timeout value must be between [0..255]..."); - return false; + error("srl_timeout: timeout value must be between [-1..255]..."); + return -1; } - /* - // Disable timeout, enable blocking read + // Disable custom timeout, enable blocking read if (timeout < 0) { this->blocking_read = true; - BITMASK_SET(this->config.c_lflag, ICANON); // Set canonical mode - this->config.c_cc[VMIN] = 1; - this->config.c_cc[VTIME] = 0; + timeout = 5; + } + // Enable custom timeout, disable blocking read + else + { + this->blocking_read = false; } - */ - // Enable timeout, disable blocking read - this->blocking_read = false; BITMASK_CLEAR(this->config.c_lflag, ICANON); // Set non-canonical mode this->config.c_cc[VMIN] = 0; this->config.c_cc[VTIME] = (unsigned) timeout; // Set timeout of 'timeout * 10' seconds if (tcsetattr(this->get_fd(), TCSANOW, &this->config) < 0) { error("srl_timeout: error setting stop bits..."); - return false; + return -1; } - return true; + return 1; } int octave_serial::get_timeout() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-16 07:35:12
|
Revision: 11034 http://octave.svn.sourceforge.net/octave/?rev=11034&view=rev Author: paramaniac Date: 2012-09-16 07:35:06 +0000 (Sun, 16 Sep 2012) Log Message: ----------- control: minor touch up in draft code Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-16 07:31:08 UTC (rev 11033) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-16 07:35:06 UTC (rev 11034) @@ -23,7 +23,7 @@ ## Version: 0.3 % function [y, t, x_arr] = __time_response_2__ (sys, resptype, plotflag, tfinal, dt, x0, sysname) -function [y, t, x_arr] = __time_response_2__ (resptype, args) +function [y, t, x] = __time_response_2__ (resptype, args) sys_idx = cellfun (@isa, args, {"lti"}); # look for LTI models sys_cell = cellfun (@ss, args(sys_idx)); # system must be proper @@ -96,8 +96,26 @@ ## time vector t = reshape (0 : dt : tfinal, [], 1); l_t = length (t); -%} +%} +%function [y, x_arr] = __initial_response__ (sys, sys_dt, t, x0) +%function [y, x_arr] = __step_response__ (sys_dt, t) +%function [y, x_arr] = __impulse_response__ (sys, sys_dt, t) + + switch (resptype) + case "initial" + [y, x] = cellfun (@__initial_response__, sys_cell, sys_dt_cell, t, {x0} or x0); + case "step" + [y, x] = cellfun (@__step_response__, sys_dt_cell, t); + case "impulse" + [y, x] = cellfun (@__impulse_response__, sys_cell, sys_dt_cell, t); + otherwise + error ("time_response: invalid response type"); + endswitch + + + + if (plotflag) # display plot switch (resptype) case "initial" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2012-09-16 07:31:14
|
Revision: 11033 http://octave.svn.sourceforge.net/octave/?rev=11033&view=rev Author: cdf Date: 2012-09-16 07:31:08 +0000 (Sun, 16 Sep 2012) Log Message: ----------- patches for compatibility with mingw Modified Paths: -------------- trunk/octave-forge/extra/ocs/PKG_ADD trunk/octave-forge/extra/ocs/PKG_DEL Modified: trunk/octave-forge/extra/ocs/PKG_ADD =================================================================== --- trunk/octave-forge/extra/ocs/PKG_ADD 2012-09-15 21:49:01 UTC (rev 11032) +++ trunk/octave-forge/extra/ocs/PKG_ADD 2012-09-16 07:31:08 UTC (rev 11033) @@ -4,15 +4,15 @@ if (! exist (fullfile (dirname, "inst"), "dir")) ## Run this if the package is installed for ii=1:length (dirlist) - addpath ( [ dirname "/../" dirlist{ii}],"-end") + addpath (fullfile (dirname, dirlist{ii}), "-end") endfor else ## Run this if we are testing the package without installation for ii=1:length(dirlist) - addpath ([ dirname "/inst/" dirlist{ii}]) - addpath ([ dirname "/src/"]) + addpath (fullfile (dirname, "inst", dirlist{ii})) + addpath (fullfile (dirname, "src")) endfor endif -warning('off', 'Octave:fopen-file-in-path'); +warning ("off", "Octave:fopen-file-in-path"); clear dirlist dirname Modified: trunk/octave-forge/extra/ocs/PKG_DEL =================================================================== --- trunk/octave-forge/extra/ocs/PKG_DEL 2012-09-15 21:49:01 UTC (rev 11032) +++ trunk/octave-forge/extra/ocs/PKG_DEL 2012-09-16 07:31:08 UTC (rev 11033) @@ -1,15 +1,17 @@ dirlist = {"utl", "asm", "tst", "nls", "prs", "sbn"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); -for ii=1:length (dirlist) - if (! exist (fullfile (dirname, "inst"), "dir")) - ## Run this if the package is installed - rmpath ( [ dirname "/../" dirlist{ii}]) - else - ## Run this if we are testing the package without installation - rmpath ([ dirname "/inst/" dirlist{ii}]) - rmpath ([ dirname "/src/"]) - end -end +if (! exist (fullfile (dirname, "inst"), "dir")) + ## Run this if the package is installed + for ii=1:length (dirlist) + rmpath (fullfile (dirname, "..", dirlist{ii})) + endfor +else + ## Run this if we are testing the package without installation + for ii=1:length (dirlist) + rmpath (fullfile (dirname, "inst", dirlist{ii})) + endfor + rmpath (fullfile (dirname, "src")) +endif clear dirlist dirname This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-15 21:49:07
|
Revision: 11032 http://octave.svn.sourceforge.net/octave/?rev=11032&view=rev Author: jpicarbajal Date: 2012-09-15 21:49:01 +0000 (Sat, 15 Sep 2012) Log Message: ----------- geometry: Small bug in drawArrow. Modified Paths: -------------- trunk/octave-forge/main/geometry/inst/geom2d/drawArrow.m Modified: trunk/octave-forge/main/geometry/inst/geom2d/drawArrow.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom2d/drawArrow.m 2012-09-15 18:22:15 UTC (rev 11031) +++ trunk/octave-forge/main/geometry/inst/geom2d/drawArrow.m 2012-09-15 21:49:01 UTC (rev 11032) @@ -59,12 +59,11 @@ end % parse arrow coordinate - var = varargin{1}; - if size(var, 2)==4 - x1 = var(:,1); - y1 = var(:,2); - x2 = var(:,3); - y2 = var(:,4); + if size(varargin{1}, 2)==4 + x1 = varargin{1}(:,1); + y1 = varargin{1}(:,2); + x2 = varargin{1}(:,3); + y2 = varargin{1}(:,4); varargin = varargin(2:end); elseif length(varargin)>3 x1 = varargin{1}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-15 18:22:21
|
Revision: 11031 http://octave.svn.sourceforge.net/octave/?rev=11031&view=rev Author: paramaniac Date: 2012-09-15 18:22:15 +0000 (Sat, 15 Sep 2012) Log Message: ----------- control: prepare release of control-2.3.54 (2) Modified Paths: -------------- trunk/octave-forge/main/control/devel/RELEASE_PACKAGE Modified: trunk/octave-forge/main/control/devel/RELEASE_PACKAGE =================================================================== --- trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2012-09-15 18:21:52 UTC (rev 11030) +++ trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2012-09-15 18:22:15 UTC (rev 11031) @@ -21,12 +21,12 @@ rm -R ~/octave/__TEMP__/control/devel cd ~/octave/__TEMP__ grep -i version control/DESCRIPTION -tar czf control-2.3.53.tar.gz control/ -md5 control-2.3.53.tar.gz -md5 control-2.3.53.tar.gz > md5_control_pkg.txt -uuencode control-2.3.53.tar.gz < control-2.3.53.tar.gz > control-2.3.53.tar.gz.uue +tar czf control-2.3.54.tar.gz control/ +md5 control-2.3.54.tar.gz +md5 control-2.3.54.tar.gz > md5_control_pkg.txt +uuencode control-2.3.54.tar.gz < control-2.3.54.tar.gz > control-2.3.54.tar.gz.uue octave -q --eval \ -"pkg install control-2.3.53.tar.gz" +"pkg install control-2.3.54.tar.gz" octave -q --eval \ "pkg load generate_html; generate_package_html ('control', 'control-html', 'octave-forge')" tar czf control-html.tar.gz control-html @@ -41,7 +41,7 @@ ===================================================================================== rm -R ~/octave/__TEMP__ -rm -R ~/octave/control-2.3.53 +rm -R ~/octave/control-2.3.54 ===================================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-15 18:22:01
|
Revision: 11030 http://octave.svn.sourceforge.net/octave/?rev=11030&view=rev Author: paramaniac Date: 2012-09-15 18:21:52 +0000 (Sat, 15 Sep 2012) Log Message: ----------- control: prepare release of control-2.3.54 Modified Paths: -------------- trunk/octave-forge/main/control/DESCRIPTION trunk/octave-forge/main/control/NEWS trunk/octave-forge/main/control/devel/PROJECTS trunk/octave-forge/main/control/devel/__time_response_2__.m trunk/octave-forge/main/control/devel/pdfdoc/control.tex trunk/octave-forge/main/control/devel/step2.m trunk/octave-forge/main/control/doc/control.pdf trunk/octave-forge/main/control/doc/control.tex trunk/octave-forge/main/control/doc/functions.texi Modified: trunk/octave-forge/main/control/DESCRIPTION =================================================================== --- trunk/octave-forge/main/control/DESCRIPTION 2012-09-15 16:02:57 UTC (rev 11029) +++ trunk/octave-forge/main/control/DESCRIPTION 2012-09-15 18:21:52 UTC (rev 11030) @@ -1,6 +1,6 @@ Name: Control -Version: 2.3.53 -Date: 2012-08-27 +Version: 2.3.54 +Date: 2012-09-15 Author: Lukas Reichlin <luk...@gm...> Maintainer: Lukas Reichlin <luk...@gm...> Title: Control Systems Modified: trunk/octave-forge/main/control/NEWS =================================================================== --- trunk/octave-forge/main/control/NEWS 2012-09-15 16:02:57 UTC (rev 11029) +++ trunk/octave-forge/main/control/NEWS 2012-09-15 18:21:52 UTC (rev 11030) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the control package =============================================================================== -control-2.3.54 Release Date: 2012-xx-yy Release Manager: Lukas Reichlin +control-2.3.54 Release Date: 2012-09-15 Release Manager: Lukas Reichlin =============================================================================== ** Multiplot feature for frequency-domain plotting: @@ -9,6 +9,12 @@ bode nichols pzmap bodemag nyquist sigma + The functions above support calls like + sigma (sys1, sys2, ...), nyquist (sys1, 'b', sys2, 'r', ...), + bode (sys1, '-k', sys2, '-.k', sys3, ':k', {wmin, wmax}). + Time domain functions are not yet multiplot ready, but they will follow in + control-2.4.0. + ** plot A selection of experiments from iddata identification datasets can be plotted by plot (dat, exp) instead of plot (dat(:,:,:,exp)). Modified: trunk/octave-forge/main/control/devel/PROJECTS =================================================================== --- trunk/octave-forge/main/control/devel/PROJECTS 2012-09-15 16:02:57 UTC (rev 11029) +++ trunk/octave-forge/main/control/devel/PROJECTS 2012-09-15 18:21:52 UTC (rev 11030) @@ -10,8 +10,8 @@ General: ------- - * Multiplot feature for time and frequency response functions. - sigma (sys1, sys2, ...), step (sys1, "b", sys2, "r", ...) + * Multiplot feature for time response functions and lsim. + impulse (sys1, sys2, ...), step (sys1, "b", sys2, "r", ...) * Improve @lti/subsasgn.m @@ -27,7 +27,8 @@ * Implement zpk models and @zpset similar to @tfpoly. - * SLICOT system identification. Under construction in extra/control-devel + * SLICOT non-linear system identification. + idnlmodel class and simulation of Wiener models with SLICOT. * Descriptor support for pole placement command "place". @@ -56,6 +57,8 @@ which override the generic commands (@lti/horzcat, @lti/vertcat) could make practical sense. + * Support more than two arguments in __sys_group__. + * Display individual warnings/errors for iwarn/info in oct-files. * Airtight argument checking for oct-files. Currently there are no checks Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-15 16:02:57 UTC (rev 11029) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-15 18:21:52 UTC (rev 11030) @@ -1,4 +1,4 @@ -## Copyright (C) 2009, 2010 Lukas F. Reichlin +## Copyright (C) 2009, 2010, 2012 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,7 +20,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.2 +## Version: 0.3 % function [y, t, x_arr] = __time_response_2__ (sys, resptype, plotflag, tfinal, dt, x0, sysname) function [y, t, x_arr] = __time_response_2__ (resptype, args) Modified: trunk/octave-forge/main/control/devel/pdfdoc/control.tex =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2012-09-15 16:02:57 UTC (rev 11029) +++ trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2012-09-15 18:21:52 UTC (rev 11030) @@ -3,7 +3,7 @@ @setfilename control.info @settitle Octave Control Systems Package @afourpaper -@set VERSION 2.3.53 +@set VERSION 2.3.54 @finalout @c @afourwide @c %**end of header Modified: trunk/octave-forge/main/control/devel/step2.m =================================================================== --- trunk/octave-forge/main/control/devel/step2.m 2012-09-15 16:02:57 UTC (rev 11029) +++ trunk/octave-forge/main/control/devel/step2.m 2012-09-15 18:21:52 UTC (rev 11030) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009, 2012 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -54,7 +54,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 % function [y_r, t_r, x_r] = step2 (sys, tfinal = [], dt = []) function [y_r, t_r, x_r] = step2 (varargin) @@ -72,9 +72,9 @@ [y, t, x] = __time_response__ ("step", varargin, ! nargout); if (nargout) - y_r = y; - t_r = t; - x_r = x; + y_r = y{1}; + t_r = t{1}; + x_r = x{1}; endif endfunction Modified: trunk/octave-forge/main/control/doc/control.pdf =================================================================== --- trunk/octave-forge/main/control/doc/control.pdf 2012-09-15 16:02:57 UTC (rev 11029) +++ trunk/octave-forge/main/control/doc/control.pdf 2012-09-15 18:21:52 UTC (rev 11030) @@ -42,7 +42,8 @@ >> stream xڅ\x90MK1\x86\xEF\xFB+rL3\x99\xCC&\xB9*\xB6 \xE2Gݞ\xC4ònk\xE9n\xAB\xE0\xBF7i\/\x8A\xC3̛y\x9F\xBC(L:(\xBC>\xF2\xA2\xDBV\xE6\xD4\x96\xA2\xB3i\x85_:\xC7\xEC(\xD5\xCA\xF4\xA8\xD3H\xDD?Kur\x8Eb\x9E7\xD5\xD9ij\xB0j,\x9AEƫ -\x817A4\xCF\xE2Qv\xFB\x9D"\x94\xC7a\xBFQ\x9A<Kɏ\xD4SsU]6\xD5\xEB\xF7\xEA\xF4\x90#\x83\xA70"\x8Cd\x89+\xEDz\xB1\xA8\xEE\x8B%\xB3@\xD1D̖d j\x8C\x82\x83\xF4\xBE\xF8^$_F_"\xF9\xF0q8\xF6[\xA5QJ\xE3.\xCF\xDB.\xDFk\xC5,\xDBe_\x8B\xFDP\x8A\xE9\xCD<N\xDEv\xC76\xEB\xDE\xF3\xD5g\xF6ӷ\xD1\xB9\xDAfmO\xDA\xC5 |
From: <ean...@us...> - 2012-09-15 16:03:04
|
Revision: 11029 http://octave.svn.sourceforge.net/octave/?rev=11029&view=rev Author: eandrius Date: 2012-09-15 16:02:57 +0000 (Sat, 15 Sep 2012) Log Message: ----------- instrument-control: fix for 'no newline at end of file' compiler warning Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc trunk/octave-forge/main/instrument-control/src/serial/srl_baudrate.cc trunk/octave-forge/main/instrument-control/src/serial/srl_bytesize.cc trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc trunk/octave-forge/main/instrument-control/src/serial/srl_flush.cc trunk/octave-forge/main/instrument-control/src/serial/srl_parity.cc trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc trunk/octave-forge/main/instrument-control/src/serial/srl_stopbits.cc trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc trunk/octave-forge/main/instrument-control/src/serial/srl_write.cc Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -85,4 +85,4 @@ } return this->addr; -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -55,4 +55,4 @@ this->fd = -1; return retval; -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_baudrate.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_baudrate.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_baudrate.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -202,4 +202,4 @@ return retval; -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_bytesize.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_bytesize.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_bytesize.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -134,4 +134,4 @@ retval = 8; return retval; -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -71,4 +71,4 @@ this->fd = -1; return retval; -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_flush.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_flush.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_flush.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -103,4 +103,4 @@ } return ::tcflush(this->get_fd(), flag); -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_parity.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_parity.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_parity.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -139,4 +139,4 @@ return "Odd"; else return "Even"; -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -112,4 +112,4 @@ } return ::read(get_fd(), buf, len); -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_stopbits.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_stopbits.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_stopbits.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -123,4 +123,4 @@ return 2; else return 1; -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -120,4 +120,4 @@ return -1; else return this->config.c_cc[VTIME]; -} \ No newline at end of file +} Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_write.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_write.cc 2012-09-15 15:16:30 UTC (rev 11028) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_write.cc 2012-09-15 16:02:57 UTC (rev 11029) @@ -103,4 +103,4 @@ } return ::write(get_fd(), buf, len); -} \ 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-09-15 15:16:36
|
Revision: 11028 http://octave.svn.sourceforge.net/octave/?rev=11028&view=rev Author: paramaniac Date: 2012-09-15 15:16:30 +0000 (Sat, 15 Sep 2012) Log Message: ----------- control: quicksave draft code Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.m Modified: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-15 14:36:20 UTC (rev 11027) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-15 15:16:30 UTC (rev 11028) @@ -35,6 +35,7 @@ tmp = cellfun (@is_real_matrix, args); vec_idx = find (tmp); n_vec = length (vec_idx) + n_sys = length (sys_cell) if (n_vec >= 1) arg = args{vec_idx(1)}; @@ -57,8 +58,6 @@ tmp = (@c2d, sys_cell(ct_idx), dt, {"zoh"}, "uniformoutput", false) sys_dt_cell(ct_idx) = tmp; - -endfunction %{ if (! isa (sys, "ss")) sys = ss (sys); # sys must be proper @@ -99,6 +98,141 @@ l_t = length (t); %} + if (plotflag) # display plot + switch (resptype) + case "initial" + str = "Response to Initial Conditions"; + cols = 1; + case "step" + str = "Step Response"; + cols = m; + case "impulse" + str = "Impulse Response"; + cols = m; + otherwise + error ("time_response: invalid response type"); + endswitch + + for i = 1 : n_sys + t = t{i}; + y = y{i}; + discrete = ! ct_idx(i); + if (discrete) # discrete system + for k = 1 : p + for j = 1 : cols + subplot (p, cols, (k-1)*cols+j); + stairs (t, y(:, k, j)); + hold on; + grid ("on"); + if (i == n_sys && k == 1 && j == 1) + title (str); + endif + if (i == n_sys && j == 1) + ylabel (sprintf ("Amplitude %s", outname{k})); + endif + endfor + endfor + else # continuous system + for k = 1 : p + for j = 1 : cols + subplot (p, cols, (k-1)*cols+j); + plot (t, y(:, k, j)); + hold on; + grid ("on"); + if (i == n_sys && k == 1 && j == 1) + title (str); + endif + if (i == n_sys && j == 1) + ylabel (sprintf ("Amplitude %s", outname{k})); + endif + endfor + endfor + endif + endfor + xlabel ("Time [s]"); + hold off; + endif + +%{ + if (plotflag) # display plot + + ## TODO: Set correct titles, especially for multi-input systems + + stable = isstable (sys); + outname = get (sys, "outname"); + outname = __labels__ (outname, "y_"); + + if (strcmp (resptype, "initial")) + cols = 1; + else + cols = m; + endif + + if (discrete) # discrete system + for k = 1 : p + for j = 1 : cols + + subplot (p, cols, (k-1)*cols+j); + + if (stable) + stairs (t, [y(:, k, j), yfinal(k, j) * ones(l_t, 1)]); + else + stairs (t, y(:, k, j)); + endif + + grid ("on"); + + if (k == 1 && j == 1) + title (str); + endif + + if (j == 1) + ylabel (sprintf ("Amplitude %s", outname{k})); + endif + + endfor + endfor + + xlabel ("Time [s]"); + + else # continuous system + for k = 1 : p + for j = 1 : cols + + subplot (p, cols, (k-1)*cols+j); + + if (stable) + plot (t, [y(:, k, j), yfinal(k, j) * ones(l_t, 1)]); + else + plot (t, y(:, k, j)); + endif + + grid ("on"); + + if (k == 1 && j == 1) + title (str); + endif + + if (j == 1) + ylabel (sprintf ("Amplitude %s", outname{k})); + endif + + endfor + endfor + + xlabel ("Time [s]"); + + endif + endif + +endfunction +%} + +endfunction + + + + function [y, x_arr] = __initial_response__ (sys, sys_dt, t, x0) [A, B, C, D] = ssdata (sys); @@ -207,82 +341,11 @@ endfunction -%{ - if (plotflag) # display plot - ## TODO: Set correct titles, especially for multi-input systems +function - stable = isstable (sys); - outname = get (sys, "outname"); - outname = __labels__ (outname, "y_"); - if (strcmp (resptype, "initial")) - cols = 1; - else - cols = m; - endif - if (discrete) # discrete system - for k = 1 : p - for j = 1 : cols - - subplot (p, cols, (k-1)*cols+j); - - if (stable) - stairs (t, [y(:, k, j), yfinal(k, j) * ones(l_t, 1)]); - else - stairs (t, y(:, k, j)); - endif - - grid ("on"); - - if (k == 1 && j == 1) - title (str); - endif - - if (j == 1) - ylabel (sprintf ("Amplitude %s", outname{k})); - endif - - endfor - endfor - - xlabel ("Time [s]"); - - else # continuous system - for k = 1 : p - for j = 1 : cols - - subplot (p, cols, (k-1)*cols+j); - - if (stable) - plot (t, [y(:, k, j), yfinal(k, j) * ones(l_t, 1)]); - else - plot (t, y(:, k, j)); - endif - - grid ("on"); - - if (k == 1 && j == 1) - title (str); - endif - - if (j == 1) - ylabel (sprintf ("Amplitude %s", outname{k})); - endif - - endfor - endfor - - xlabel ("Time [s]"); - - endif - endif - -endfunction -%} - - % function [tfinal, dt] = __sim_horizon__ (A, discrete, tfinal, Ts) function [tfinal, dt] = __sim_horizon__ (sys, tfinal, Ts) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-15 14:36:28
|
Revision: 11027 http://octave.svn.sourceforge.net/octave/?rev=11027&view=rev Author: paramaniac Date: 2012-09-15 14:36:20 +0000 (Sat, 15 Sep 2012) Log Message: ----------- control: add draft code for multiplot time responses Added Paths: ----------- trunk/octave-forge/main/control/devel/__time_response_2__.m trunk/octave-forge/main/control/devel/step2.m Added: trunk/octave-forge/main/control/devel/__time_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__time_response_2__.m (rev 0) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-15 14:36:20 UTC (rev 11027) @@ -0,0 +1,363 @@ +## Copyright (C) 2009, 2010 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 -*- +## Common code for the time response functions step, impulse and initial. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2009 +## Version: 0.2 + +% function [y, t, x_arr] = __time_response_2__ (sys, resptype, plotflag, tfinal, dt, x0, sysname) +function [y, t, x_arr] = __time_response_2__ (resptype, args) + + sys_idx = cellfun (@isa, args, {"lti"}); # look for LTI models + sys_cell = cellfun (@ss, args(sys_idx)); # system must be proper + + if (! size_equal (sys_cell{:})) + error ("%s: models must have equal sizes", resptype); + endif + + tmp = cellfun (@is_real_matrix, args); + vec_idx = find (tmp); + n_vec = length (vec_idx) + + if (n_vec >= 1) + arg = args{vec_idx(1)}; + + endif + + ## extract tfinal/t, dt, x0 + + [tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, dt); + + tfinal = max (tfinal); + + % __sim_horizon__ (sys, tfinal, dt); + + + hier sim_horizon + + ct_idx = cellfun (@isct, sys_cell) + sys_dt_cell = sys_cell; + tmp = (@c2d, sys_cell(ct_idx), dt, {"zoh"}, "uniformoutput", false) + sys_dt_cell(ct_idx) = tmp; + + +endfunction +%{ + if (! isa (sys, "ss")) + sys = ss (sys); # sys must be proper + endif + + if (is_real_vector (tfinal) && length (tfinal) > 1) # time vector t passed + dt = tfinal(2) - tfinal(1); # assume that t is regularly spaced + tfinal = tfinal(end); + endif + + [A, B, C, D, tsam] = ssdata (sys); + + discrete = ! isct (sys); # static gains are treated as analog systems + tsam = abs (tsam); # use 1 second if tsam is unspecified (-1) + + if (discrete) + if (! isempty (dt)) + warning ("time_response: argument dt has no effect on sampling time of discrete system"); + endif + + dt = tsam; + endif + + [tfinal, dt] = __sim_horizon__ (A, discrete, tfinal, dt); + + if (! discrete) + sys = c2d (sys, dt, "zoh"); + endif + + [F, G] = ssdata (sys); # matrices C and D don't change + + n = rows (F); # number of states + m = columns (G); # number of inputs + p = rows (C); # number of outputs + + ## time vector + t = reshape (0 : dt : tfinal, [], 1); + l_t = length (t); +%} + +function [y, x_arr] = __initial_response__ (sys, sys_dt, t, x0) + + [A, B, C, D] = ssdata (sys); + [F, G] = ssdata (sys_dt); + + n = rows (F); # number of states + m = columns (G); # number of inputs + p = rows (C); # number of outputs + l_t = length (t); + + ## preallocate memory + y = zeros (l_t, p); + x_arr = zeros (l_t, n); + + ## initial conditions + x = reshape (x0, [], 1); # make sure that x is a column vector + + if (n != length (x0) || ! is_real_vector (x0)) + error ("initial: x0 must be a real vector with %d elements", n); + endif + + ## simulation + for k = 1 : l_t + y(k, :) = C * x; + x_arr(k, :) = x; + x = F * x; + endfor + +endfunction + + +function [y, x_arr] = __step_response__ (sys_dt, t) + + [F, G, C, D] = ssdata (sys_dt); + + n = rows (F); # number of states + m = columns (G); # number of inputs + p = rows (C); # number of outputs + l_t = length (t); + + ## preallocate memory + y = zeros (l_t, p, m); + x_arr = zeros (l_t, n, m); + + for j = 1 : m # for every input channel + ## initial conditions + x = zeros (n, 1); + u = zeros (m, 1); + u(j) = 1; + + ## simulation + for k = 1 : l_t + y(k, :, j) = C * x + D * u; + x_arr(k, :, j) = x; + x = F * x + G * u; + endfor + endfor + +endfunction + + +function [y, x_arr] = __impulse_response__ (sys, sys_dt, t) + + [A, B, C, D, dt] = ssdata (sys); + [F, G] = ssdata (sys_dt); + discrete = ! isct (sys); + + n = rows (F); # number of states + m = columns (G); # number of inputs + p = rows (C); # number of outputs + l_t = length (t); + + ## preallocate memory + y = zeros (l_t, p, m); + x_arr = zeros (l_t, n, m); + + for j = 1 : m # for every input channel + ## initial conditions + u = zeros (m, 1); + u(j) = 1; + + if (discrete) + x = zeros (n, 1); # zero by definition + y(1, :, j) = D * u / dt; + x_arr(1, :, j) = x; + x = G * u / dt; + else + x = B * u; # B, not G! + y(1, :, j) = C * x; + x_arr(1, :, j) = x; + x = F * x; + endif + + ## simulation + for k = 2 : l_t + y (k, :, j) = C * x; + x_arr(k, :, j) = x; + x = F * x; + endfor + endfor + + if (discrete) + y *= dt; + x_arr *= dt; + endif + +endfunction + +%{ + if (plotflag) # display plot + + ## TODO: Set correct titles, especially for multi-input systems + + stable = isstable (sys); + outname = get (sys, "outname"); + outname = __labels__ (outname, "y_"); + + if (strcmp (resptype, "initial")) + cols = 1; + else + cols = m; + endif + + if (discrete) # discrete system + for k = 1 : p + for j = 1 : cols + + subplot (p, cols, (k-1)*cols+j); + + if (stable) + stairs (t, [y(:, k, j), yfinal(k, j) * ones(l_t, 1)]); + else + stairs (t, y(:, k, j)); + endif + + grid ("on"); + + if (k == 1 && j == 1) + title (str); + endif + + if (j == 1) + ylabel (sprintf ("Amplitude %s", outname{k})); + endif + + endfor + endfor + + xlabel ("Time [s]"); + + else # continuous system + for k = 1 : p + for j = 1 : cols + + subplot (p, cols, (k-1)*cols+j); + + if (stable) + plot (t, [y(:, k, j), yfinal(k, j) * ones(l_t, 1)]); + else + plot (t, y(:, k, j)); + endif + + grid ("on"); + + if (k == 1 && j == 1) + title (str); + endif + + if (j == 1) + ylabel (sprintf ("Amplitude %s", outname{k})); + endif + + endfor + endfor + + xlabel ("Time [s]"); + + endif + endif + +endfunction +%} + + +% function [tfinal, dt] = __sim_horizon__ (A, discrete, tfinal, Ts) +function [tfinal, dt] = __sim_horizon__ (sys, tfinal, Ts) + + ## code based on __stepimp__.m of Kai P. Mueller and A. Scottedward Hodel + + TOL = 1.0e-10; # values below TOL are assumed to be zero + N_MIN = 50; # min number of points + N_MAX = 2000; # max number of points + N_DEF = 1000; # default number of points + T_DEF = 10; # default simulation time + + ev = pole (sys); + n = length (ev); + + if (discrete) + ## perform bilinear transformation on poles in z + for k = 1 : n + pol = ev(k); + if (abs (pol + 1) < TOL) + ev(k) = 0; + else + ev(k) = 2 / Ts * (pol - 1) / (pol + 1); + endif + endfor + endif + + ## remove poles near zero from eigenvalue array ev + nk = n; + for k = 1 : n + if (abs (real (ev(k))) < TOL) + ev(k) = 0; + nk -= 1; + endif + endfor + + if (nk == 0) + if (isempty (tfinal)) + tfinal = T_DEF; + endif + + if (! discrete) + dt = tfinal / N_DEF; + endif + else + ev = ev(find (ev)); + ev_max = max (abs (ev)); + + if (! discrete) + dt = 0.2 * pi / ev_max; + endif + + if (isempty (tfinal)) + ev_min = min (abs (real (ev))); + tfinal = 5.0 / ev_min; + + ## round up + yy = 10^(ceil (log10 (tfinal)) - 1); + tfinal = yy * ceil (tfinal / yy); + endif + + if (! discrete) + N = tfinal / dt; + + if (N < N_MIN) + dt = tfinal / N_MIN; + endif + + if (N > N_MAX) + dt = tfinal / N_MAX; + endif + endif + endif + + if (! isempty (Ts)) # catch case cont. system with dt specified + dt = Ts; + endif + +endfunction Added: trunk/octave-forge/main/control/devel/step2.m =================================================================== --- trunk/octave-forge/main/control/devel/step2.m (rev 0) +++ trunk/octave-forge/main/control/devel/step2.m 2012-09-15 14:36:20 UTC (rev 11027) @@ -0,0 +1,80 @@ +## Copyright (C) 2009 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{y}, @var{t}, @var{x}] =} step (@var{sys}) +## @deftypefnx{Function File} {[@var{y}, @var{t}, @var{x}] =} step (@var{sys}, @var{t}) +## @deftypefnx{Function File} {[@var{y}, @var{t}, @var{x}] =} step (@var{sys}, @var{tfinal}) +## @deftypefnx{Function File} {[@var{y}, @var{t}, @var{x}] =} step (@var{sys}, @var{tfinal}, @var{dt}) +## Step response of LTI system. +## If no output arguments are given, the response is printed on the screen. +## +## @strong{Inputs} +## @table @var +## @item sys +## LTI model. +## @item t +## Time vector. Should be evenly spaced. If not specified, it is calculated by +## the poles of the system to reflect adequately the response transients. +## @item tfinal +## Optional simulation horizon. If not specified, it is calculated by +## the poles of the system to reflect adequately the response transients. +## @item dt +## Optional sampling time. Be sure to choose it small enough to capture transient +## phenomena. If not specified, it is calculated by the poles of the system. +## @end table +## +## @strong{Outputs} +## @table @var +## @item y +## Output response array. Has as many rows as time samples (length of t) +## and as many columns as outputs. +## @item t +## Time row vector. +## @item x +## State trajectories array. Has @code{length (t)} rows and as many columns as states. +## @end table +## +## @seealso{impulse, initial, lsim} +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2009 +## Version: 0.1 + +% function [y_r, t_r, x_r] = step2 (sys, tfinal = [], dt = []) +function [y_r, t_r, x_r] = step2 (varargin) + + if (nargin == 0) + print_usage (); + endif + + %tmp = cellfun (@isa, varargin, {"lti"}); + %sys_idx = find (tmp); + + + %sys_names = arrayfun (@inputname, sys_idx); + + [y, t, x] = __time_response__ ("step", varargin, ! nargout); + + if (nargout) + y_r = y; + t_r = t; + x_r = x; + endif + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-15 11:15:56
|
Revision: 11026 http://octave.svn.sourceforge.net/octave/?rev=11026&view=rev Author: paramaniac Date: 2012-09-15 11:15:50 +0000 (Sat, 15 Sep 2012) Log Message: ----------- control: solve possible problem with inputname Modified Paths: -------------- trunk/octave-forge/main/control/inst/bode.m trunk/octave-forge/main/control/inst/bodemag.m trunk/octave-forge/main/control/inst/nichols.m trunk/octave-forge/main/control/inst/nyquist.m trunk/octave-forge/main/control/inst/pzmap.m trunk/octave-forge/main/control/inst/sigma.m Modified: trunk/octave-forge/main/control/inst/bode.m =================================================================== --- trunk/octave-forge/main/control/inst/bode.m 2012-09-15 07:07:18 UTC (rev 11025) +++ trunk/octave-forge/main/control/inst/bode.m 2012-09-15 11:15:50 UTC (rev 11026) @@ -77,7 +77,7 @@ len = numel (H); mag_args = {}; pha_args = {}; - legend_args = cell (len, 1); + legend_args = {}; for k = 1:len if (k == len) @@ -88,7 +88,9 @@ style = varargin(style_idx(style_idx > sys_idx(k) & style_idx <= lim)); mag_args = cat (2, mag_args, w(k), mag_db(k), style); pha_args = cat (2, pha_args, w(k), pha(k), style); - legend_args{k} = inputname(sys_idx(k)); # watch out for bode (lticell{:}) + try + legend_args = cat (2, legend_args, inputname(sys_idx(k))); # watch out for bode (lticell{:}) + end_try_catch endfor subplot (2, 1, 1) Modified: trunk/octave-forge/main/control/inst/bodemag.m =================================================================== --- trunk/octave-forge/main/control/inst/bodemag.m 2012-09-15 07:07:18 UTC (rev 11025) +++ trunk/octave-forge/main/control/inst/bodemag.m 2012-09-15 11:15:50 UTC (rev 11026) @@ -73,7 +73,7 @@ len = numel (H); mag_args = {}; - legend_args = cell (len, 1); + legend_args = {}; for k = 1:len if (k == len) @@ -83,7 +83,9 @@ endif style = varargin(style_idx(style_idx > sys_idx(k) & style_idx <= lim)); mag_args = cat (2, mag_args, w(k), mag_db(k), style); - legend_args{k} = inputname(sys_idx(k)); # watch out for bode (lticell{:}) + try + legend_args = cat (2, legend_args, inputname(sys_idx(k))); # watch out for bodemag (lticell{:}) + end_try_catch endfor semilogx (mag_args{:}) Modified: trunk/octave-forge/main/control/inst/nichols.m =================================================================== --- trunk/octave-forge/main/control/inst/nichols.m 2012-09-15 07:07:18 UTC (rev 11025) +++ trunk/octave-forge/main/control/inst/nichols.m 2012-09-15 11:15:50 UTC (rev 11026) @@ -86,7 +86,11 @@ endif style = varargin(style_idx(style_idx > sys_idx(k) & style_idx <= lim)); plot_args = cat (2, plot_args, pha(k), mag_db(k), style); - legend_args{k} = inputname(sys_idx(k)); # watch out for nichols (lticell{:}) + try + legend_args{k} = inputname(sys_idx(k)); + catch + legend_args{k} = ""; + end_try_catch endfor plot (plot_args{:}) Modified: trunk/octave-forge/main/control/inst/nyquist.m =================================================================== --- trunk/octave-forge/main/control/inst/nyquist.m 2012-09-15 07:07:18 UTC (rev 11025) +++ trunk/octave-forge/main/control/inst/nyquist.m 2012-09-15 11:15:50 UTC (rev 11026) @@ -94,7 +94,11 @@ pos_args = cat (2, pos_args, re{k}, im{k}, style); neg_args = cat (2, neg_args, re{k}, -im{k}, style); endif - legend_args{k} = inputname(sys_idx(k)); + try + legend_args{k} = inputname(sys_idx(k)); + catch + legend_args{k} = ""; + end_try_catch endfor ## FIXME: pos_args = cat (2, pos_args, re{k}, im{k}, {"-", "color", col}, style); Modified: trunk/octave-forge/main/control/inst/pzmap.m =================================================================== --- trunk/octave-forge/main/control/inst/pzmap.m 2012-09-15 07:07:18 UTC (rev 11025) +++ trunk/octave-forge/main/control/inst/pzmap.m 2012-09-15 11:15:50 UTC (rev 11026) @@ -86,11 +86,14 @@ pol_args = cat (2, pol_args, pol_re{k}, pol_im{k}, style); zer_args = cat (2, zer_args, zer_re{k}, zer_im{k}, style); endif + try + legend_args{k} = inputname(sys_idx(k)); + catch + legend_args{k} = ""; + end_try_catch + endfor - ## FIXME: try to combine "x", "o" and style for custom colors - - legend_args{k} = inputname(sys_idx(k)); - endfor + ## FIXME: try to combine "x", "o" and style for custom colors h = plot (pol_args{:}, zer_args{:}); grid ("on") Modified: trunk/octave-forge/main/control/inst/sigma.m =================================================================== --- trunk/octave-forge/main/control/inst/sigma.m 2012-09-15 07:07:18 UTC (rev 11025) +++ trunk/octave-forge/main/control/inst/sigma.m 2012-09-15 11:15:50 UTC (rev 11026) @@ -106,7 +106,11 @@ else plot_args = cat (2, plot_args, w(k), sv_db(k), style); endif - legend_args{k} = inputname(sys_idx(k)); # watch out for sigma (lticell{:}) + try + legend_args{k} = inputname(sys_idx(k)); # watch out for sigma (lticell{:}) + catch + legend_args{k} = ""; + end_try_catch endfor ## adjust line colors in legend This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-15 07:07:25
|
Revision: 11025 http://octave.svn.sourceforge.net/octave/?rev=11025&view=rev Author: paramaniac Date: 2012-09-15 07:07:18 +0000 (Sat, 15 Sep 2012) Log Message: ----------- control: document multiplot feature in helpstring (deftypefn) Modified Paths: -------------- trunk/octave-forge/main/control/inst/bode.m trunk/octave-forge/main/control/inst/bodemag.m trunk/octave-forge/main/control/inst/nichols.m trunk/octave-forge/main/control/inst/nyquist.m trunk/octave-forge/main/control/inst/pzmap.m trunk/octave-forge/main/control/inst/sigma.m Modified: trunk/octave-forge/main/control/inst/bode.m =================================================================== --- trunk/octave-forge/main/control/inst/bode.m 2012-09-14 21:33:53 UTC (rev 11024) +++ trunk/octave-forge/main/control/inst/bode.m 2012-09-15 07:07:18 UTC (rev 11025) @@ -16,7 +16,11 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{mag}, @var{pha}, @var{w}] =} bode (@var{sys}) +## @deftypefn {Function File} bode (@var{sys}) +## @deftypefnx {Function File} bode (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}) +## @deftypefnx {Function File} bode (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}, @var{w}) +## @deftypefnx {Function File} bode (@var{sys1}, @var{'style1'}, @dots{}, @var{sysN}, @var{'styleN'}) +## @deftypefnx {Function File} {[@var{mag}, @var{pha}, @var{w}] =} bode (@var{sys}) ## @deftypefnx {Function File} {[@var{mag}, @var{pha}, @var{w}] =} bode (@var{sys}, @var{w}) ## Bode diagram of frequency response. If no output arguments are given, ## the response is printed on the screen. Modified: trunk/octave-forge/main/control/inst/bodemag.m =================================================================== --- trunk/octave-forge/main/control/inst/bodemag.m 2012-09-14 21:33:53 UTC (rev 11024) +++ trunk/octave-forge/main/control/inst/bodemag.m 2012-09-15 07:07:18 UTC (rev 11025) @@ -16,7 +16,11 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{mag}, @var{w}] =} bodemag (@var{sys}) +## @deftypefn {Function File} bodemag (@var{sys}) +## @deftypefnx {Function File} bodemag (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}) +## @deftypefnx {Function File} bodemag (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}, @var{w}) +## @deftypefnx {Function File} bodemag (@var{sys1}, @var{'style1'}, @dots{}, @var{sysN}, @var{'styleN'}) +## @deftypefnx {Function File} {[@var{mag}, @var{w}] =} bodemag (@var{sys}) ## @deftypefnx {Function File} {[@var{mag}, @var{w}] =} bodemag (@var{sys}, @var{w}) ## Bode magnitude diagram of frequency response. If no output arguments are given, ## the response is printed on the screen. Modified: trunk/octave-forge/main/control/inst/nichols.m =================================================================== --- trunk/octave-forge/main/control/inst/nichols.m 2012-09-14 21:33:53 UTC (rev 11024) +++ trunk/octave-forge/main/control/inst/nichols.m 2012-09-15 07:07:18 UTC (rev 11025) @@ -16,7 +16,11 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{mag}, @var{pha}, @var{w}] =} nichols (@var{sys}) +## @deftypefn {Function File} nichols (@var{sys}) +## @deftypefnx {Function File} nichols (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}) +## @deftypefnx {Function File} nichols (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}, @var{w}) +## @deftypefnx {Function File} nichols (@var{sys1}, @var{'style1'}, @dots{}, @var{sysN}, @var{'styleN'}) +## @deftypefnx {Function File} {[@var{mag}, @var{pha}, @var{w}] =} nichols (@var{sys}) ## @deftypefnx {Function File} {[@var{mag}, @var{pha}, @var{w}] =} nichols (@var{sys}, @var{w}) ## Nichols chart of frequency response. If no output arguments are given, ## the response is printed on the screen. Modified: trunk/octave-forge/main/control/inst/nyquist.m =================================================================== --- trunk/octave-forge/main/control/inst/nyquist.m 2012-09-14 21:33:53 UTC (rev 11024) +++ trunk/octave-forge/main/control/inst/nyquist.m 2012-09-15 07:07:18 UTC (rev 11025) @@ -16,7 +16,11 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{re}, @var{im}, @var{w}] =} nyquist (@var{sys}) +## @deftypefn {Function File} nyquist (@var{sys}) +## @deftypefnx {Function File} nyquist (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}) +## @deftypefnx {Function File} nyquist (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}, @var{w}) +## @deftypefnx {Function File} nyquist (@var{sys1}, @var{'style1'}, @dots{}, @var{sysN}, @var{'styleN'}) +## @deftypefnx {Function File} {[@var{re}, @var{im}, @var{w}] =} nyquist (@var{sys}) ## @deftypefnx {Function File} {[@var{re}, @var{im}, @var{w}] =} nyquist (@var{sys}, @var{w}) ## Nyquist diagram of frequency response. If no output arguments are given, ## the response is printed on the screen. Modified: trunk/octave-forge/main/control/inst/pzmap.m =================================================================== --- trunk/octave-forge/main/control/inst/pzmap.m 2012-09-14 21:33:53 UTC (rev 11024) +++ trunk/octave-forge/main/control/inst/pzmap.m 2012-09-15 07:07:18 UTC (rev 11025) @@ -17,6 +17,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} pzmap (@var{sys}) +## @deftypefnx {Function File} pzmap (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}) +## @deftypefnx {Function File} pzmap (@var{sys1}, @var{'style1'}, @dots{}, @var{sysN}, @var{'styleN'}) ## @deftypefnx {Function File} {[@var{p}, @var{z}] =} pzmap (@var{sys}) ## Plot the poles and zeros of an LTI system in the complex plane. ## If no output arguments are given, the result is plotted on the screen. Modified: trunk/octave-forge/main/control/inst/sigma.m =================================================================== --- trunk/octave-forge/main/control/inst/sigma.m 2012-09-14 21:33:53 UTC (rev 11024) +++ trunk/octave-forge/main/control/inst/sigma.m 2012-09-15 07:07:18 UTC (rev 11025) @@ -16,7 +16,11 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{sv}, @var{w}] =} sigma (@var{sys}) +## @deftypefn {Function File} sigma (@var{sys}) +## @deftypefnx {Function File} sigma (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}) +## @deftypefnx {Function File} sigma (@var{sys1}, @var{sys2}, @dots{}, @var{sysN}, @var{w}) +## @deftypefnx {Function File} sigma (@var{sys1}, @var{'style1'}, @dots{}, @var{sysN}, @var{'styleN'}) +## @deftypefnx{Function File} {[@var{sv}, @var{w}] =} sigma (@var{sys}) ## @deftypefnx{Function File} {[@var{sv}, @var{w}] =} sigma (@var{sys}, @var{w}) ## @deftypefnx{Function File} {[@var{sv}, @var{w}] =} sigma (@var{sys}, @var{[]}, @var{ptype}) ## @deftypefnx{Function File} {[@var{sv}, @var{w}] =} sigma (@var{sys}, @var{w}, @var{ptype}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <i7...@us...> - 2012-09-14 21:34:00
|
Revision: 11024 http://octave.svn.sourceforge.net/octave/?rev=11024&view=rev Author: i7tiol Date: 2012-09-14 21:33:53 +0000 (Fri, 14 Sep 2012) Log Message: ----------- Fixed wrong test for existence of 'options' in leasqr. New release. Modified Paths: -------------- trunk/octave-forge/main/optim/DESCRIPTION trunk/octave-forge/main/optim/NEWS trunk/octave-forge/main/optim/inst/leasqr.m Modified: trunk/octave-forge/main/optim/DESCRIPTION =================================================================== --- trunk/octave-forge/main/optim/DESCRIPTION 2012-09-14 19:36:44 UTC (rev 11023) +++ trunk/octave-forge/main/optim/DESCRIPTION 2012-09-14 21:33:53 UTC (rev 11024) @@ -1,6 +1,6 @@ Name: Optim -Version: 1.2.0 -Date: 2012-06-12 +Version: 1.2.1 +Date: 2012-09-14 Author: various authors Maintainer: Octave-Forge community <oct...@li...> Title: Optimization. Modified: trunk/octave-forge/main/optim/NEWS =================================================================== --- trunk/octave-forge/main/optim/NEWS 2012-09-14 19:36:44 UTC (rev 11023) +++ trunk/octave-forge/main/optim/NEWS 2012-09-14 21:33:53 UTC (rev 11024) @@ -1,3 +1,9 @@ +optim 1.2.1: +------------ + + ** Bugfix in leasqr.m: errors when a function 'options' is in + namespace. + Summary of important user-visible changes for optim 1.2.0: ------------------------------------------------------------------- Modified: trunk/octave-forge/main/optim/inst/leasqr.m =================================================================== --- trunk/octave-forge/main/optim/inst/leasqr.m 2012-09-14 19:36:44 UTC (rev 11023) +++ trunk/octave-forge/main/optim/inst/leasqr.m 2012-09-14 21:33:53 UTC (rev 11024) @@ -570,7 +570,7 @@ %% only preliminary, for testing hook.testing = false; hook.new_s = false; - if (exist ('options')) + if (nargin > 9) if (isfield (options, 'testing')) hook.testing = options.testing; end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |