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: <par...@us...> - 2012-09-22 10:14:18
|
Revision: 11073 http://octave.svn.sourceforge.net/octave/?rev=11073&view=rev Author: paramaniac Date: 2012-09-22 10:14:12 +0000 (Sat, 22 Sep 2012) Log Message: ----------- control: minor bug fix (stairs doesn't like the "-" style argument) 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-22 10:10:53 UTC (rev 11072) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-22 10:14:12 UTC (rev 11073) @@ -106,7 +106,7 @@ [tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, {dt}, "uniformoutput", false); tfinal = max ([tfinal{:}]); -dt + ct_idx = cellfun (@isct, sys_cell); sys_dt_cell = sys_cell; tmp = cellfun (@c2d, sys_cell(ct_idx), dt(ct_idx), {"zoh"}, "uniformoutput", false); @@ -165,7 +165,7 @@ style = args(style_idx(style_idx > sys_idx(k) & style_idx <= lim)); if (isempty (style)) color = colororder(1+rem (k-1, rc), :); - style = {"-", "color", color}; + style = {"color", color}; endif discrete = ! ct_idx(k); if (discrete) # discrete-time system This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-22 10:10:59
|
Revision: 11072 http://octave.svn.sourceforge.net/octave/?rev=11072&view=rev Author: paramaniac Date: 2012-09-22 10:10:53 +0000 (Sat, 22 Sep 2012) Log Message: ----------- control: handle vector arguments in multiplot time responses 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-22 10:03:17 UTC (rev 11071) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-22 10:10:53 UTC (rev 11072) @@ -22,93 +22,104 @@ ## Created: October 2009 ## 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, sysname, plotflag) +% function [y, t, x_arr] = __time_response_2__ (sys, response, plotflag, tfinal, dt, x0, sysname) +function [y, t, x] = __time_response_2__ (response, args, sysname, plotflag) sys_idx = find (cellfun (@isa, args, {"lti"})); # look for LTI models, 'find' needed for plot styles 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); + error ("%s: models must have equal sizes", response); endif - vec_idx = find (cellfun (@is_real_matrix, args)); # indices of vector arguments - n_vec = length (vec_idx); # number of vector arguments - n_sys = length (sys_cell); # number of LTI systems - - %if (n_vec >= 1) - % arg = args{vec_idx(1)}; - % - %endif + vec_idx = find (cellfun (@is_real_matrix, args)); # indices of vector arguments + n_vec = length (vec_idx); # number of vector arguments + n_sys = length (sys_cell); # number of LTI systems - ## extract tfinal/t, dt, x0 - tfinal = []; - dt = {[]}; + dt = []; + x0 = []; - %[tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, dt, "uniformoutput", false); + ## extract tfinal/t, dt, x0 from args + if (strcmpi (response, "initial")) + if (n_vec < 1) + error ("initial: require initial state vector 'x0'"); + else # initial state vector x0 specified + arg = args{vec_idx(1)}; + if (is_real_vector (arg)) + x0 = arg; + else + error ("initial: initial state vector 'x0' must be a vector of real values"); + endif + if (n_vec > 1) # tfinal or time vector t specified + arg = args{vec_idx(2)}; + if (issample (arg)) + tfinal = arg; + elseif (isempty (arg)) + ## tfinal = []; # nothing to do here + elseif (is_real_vector (arg)) + dt = abs (arg(2) - arg(1)); # assume that t is regularly spaced + tfinal = arg(end); + else + warning ("initial: argument number %d ignored", vec_idx(2)); + endif + if (n_vec > 2) # sampling time dt specified + arg = args{vec_idx(3)}; + if (issample (arg)) + dt = arg; + else + warning ("initial: argument number %d ignored", vec_idx(3)); + endif + if (n_vec > 3) + warning ("initial: ignored"); + endif + endif + endif + endif + else # step or impulse response + if (n_vec > 0) # tfinal or time vector t specified + arg = args{vec_idx(1)}; + if (issample (arg)) + tfinal = arg; + elseif (isempty (arg)) + ## tfinal = []; # nothing to do here + elseif (is_real_vector (arg)) + dt = abs (arg(2) - arg(1)); # assume that t is regularly spaced + tfinal = arg(end); + else + warning ("%s: argument number %d ignored", response, vec_idx(1)); + endif + if (n_vec > 1) # sampling time dt specified + arg = args{vec_idx(2)}; + if (issample (arg)) + dt = arg; + else + warning ("%s: argument number %d ignored", response, vec_idx(2)); + endif + if (n_vec > 2) + warning ("%s: ignored", response); + endif + endif + endif + endif + ## TODO: share common code between initial and step/impulse - [tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, "uniformoutput", false); - + [tfinal, dt] = cellfun (@__sim_horizon__, sys_cell, {tfinal}, {dt}, "uniformoutput", false); tfinal = max ([tfinal{:}]); - -dt - - +dt ct_idx = cellfun (@isct, sys_cell); sys_dt_cell = sys_cell; - tmp = cellfun (@c2d, sys_cell(ct_idx), dt, {"zoh"}, "uniformoutput", false); + tmp = cellfun (@c2d, sys_cell(ct_idx), dt(ct_idx), {"zoh"}, "uniformoutput", false); sys_dt_cell(ct_idx) = tmp; -%{ - 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); -%} - - - ## 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) + switch (response) case "initial" [y, x] = cellfun (@__initial_response__, sys_dt_cell, t, {x0}, "uniformoutput", false); case "step" @@ -122,7 +133,7 @@ if (plotflag) # display plot [p, m] = size (sys_cell{1}); - switch (resptype) + switch (response) case "initial" str = "Response to Initial Conditions"; cols = 1; @@ -146,7 +157,6 @@ rc = rows (colororder); for k = 1 : n_sys # for every system - color = colororder(1+rem (k-1, rc), :); if (k == n_sys) lim = numel (args); else @@ -154,9 +164,9 @@ endif style = args(style_idx(style_idx > sys_idx(k) & style_idx <= lim)); if (isempty (style)) + color = colororder(1+rem (k-1, rc), :); style = {"-", "color", color}; endif - style discrete = ! ct_idx(k); if (discrete) # discrete-time system for i = 1 : p # for every output @@ -213,8 +223,6 @@ endfunction - - function [y, x_arr] = __initial_response__ (sys_dt, t, x0) [F, G, C, D] = ssdata (sys_dt); # system must be proper @@ -279,6 +287,7 @@ [~, B] = ssdata (sys); [F, G, C, D, dt] = ssdata (sys_dt); # system must be proper + dt = abs (dt); # use 1 second if tsam is unspecified (-1) discrete = ! isct (sys); n = rows (F); # number of states @@ -323,8 +332,6 @@ 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 @@ -339,9 +346,9 @@ n = length (ev); # number of states/poles continuous = isct (sys); discrete = ! continuous; - Ts = get (sys, "tsam"); if (discrete) + dt = Ts = abs (get (sys, "tsam")); ## perform bilinear transformation on poles in z for k = 1 : n pol = ev(k); @@ -400,8 +407,8 @@ endif endif - %if (! isempty (Ts)) # catch case cont. system with dt specified - % dt = Ts; - %endif + if (continuous && ! isempty (Ts)) # catch case cont. system with dt specified + dt = Ts; + endif endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-22 10:03:27
|
Revision: 11071 http://octave.svn.sourceforge.net/octave/?rev=11071&view=rev Author: jpicarbajal Date: 2012-09-22 10:03:17 +0000 (Sat, 22 Sep 2012) Log Message: ----------- mechanics: All copyrights fixed. hopefully :D Modified Paths: -------------- trunk/octave-forge/main/mechanics/inst/core/EAmatrix.m trunk/octave-forge/main/mechanics/inst/core/RBequations_rot.m trunk/octave-forge/main/mechanics/inst/core/private/drawAxis3D.m Modified: trunk/octave-forge/main/mechanics/inst/core/EAmatrix.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/EAmatrix.m 2012-09-22 08:40:14 UTC (rev 11070) +++ trunk/octave-forge/main/mechanics/inst/core/EAmatrix.m 2012-09-22 10:03:17 UTC (rev 11071) @@ -1,17 +1,17 @@ -%%copyright (c) 2011 Juan Pablo Carbajal <car...@if...> +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> %% -%% This program is free software: youcan redistribute itand/or modify -%% it under the terms of the GNU General Public Licenseas publishedby -%% the Free Software Foundation, either version 3 of the License, or -%% any later version. +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 3 of the License, or +%% (at your option) any later version. %% -%% This program is distributed in the hope that it willbe useful, -%% but WITHOUTaNY WARRANTY; without even the implied warranty of -%% MERCHANTABILITY or FITNESS FORa PARTICULAR PURPOSE. See the -%% GNU General Public License for more details. +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. %% -%% You should have receivedacopy of the GNU General Public License -%% along with this program. If not, see <http://www.gnu.org/licenses/>. +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- %% @deftypefn {Function File} {@var{output} = } EAmatrix (@var{angles}, @var{convention}) Modified: trunk/octave-forge/main/mechanics/inst/core/RBequations_rot.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/RBequations_rot.m 2012-09-22 08:40:14 UTC (rev 11070) +++ trunk/octave-forge/main/mechanics/inst/core/RBequations_rot.m 2012-09-22 10:03:17 UTC (rev 11071) @@ -1,26 +1,26 @@ -%%copyright (c) 2011 Juan Pablocarbajal <car...@if...> -%% -%% This program is free software: youcan redistribute itand/or modify -%% it under the terms of the GNU General Public Licenseas publishedby -%% the Free Software Foundation, either version 3 of the License, or -%% any later version. -%% -%% This program is distributed in the hope that it willbe useful, -%% but WITHOUTaNY WARRANTY; without even the implied warranty of -%% MERCHANTABILITY or FITNESS FORa PARTICULAR PURPOSE. See the -%% GNU General Public License for more details. -%% -%% You should have receivedacopy of the GNU General Public License -%% along with this program. If not, see <http://www.gnu.org/licenses/>. +## Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, see <http://www.gnu.org/licenses/>. -%% -*- texinfo -*- -%% @deftypefn {Function File} {@var{dqdt} = } RBequations_rot (@var{t}, @var{q}, @var{opt}) -%% Rotational equations of motion of rigid body fixed in one point. -%% @end deftypefn +## -*- texinfo -*- +## @deftypefn {Function File} {@var{dqdt} = } RBequations_rot (@var{t}, @var{q}, @var{opt}) +## Rotational equations of motion of rigid body fixed in one point. +## @end deftypefn function dqdt = RBequations_rot(t,q, opt) -% TODO -% 2. Actuation +# TODO +# 2. Actuation w = q(1:3,1).'; s = q(4:7,1).'; @@ -29,18 +29,17 @@ m = opt.Mass; Rcm = quatvrot(opt.CoM,s); grav = opt.Gravity; - - + + Tgrav = quatvrot((cross(Rcm,m*grav)),quatconj(s)); dqdt = zeros(7,1); - %% Euler Equations + ## Euler Equations dqdt(1:3,1) = (cross( I .* w, w ) + Tgrav)./I; - - %% Quaternion equation + + ## Quaternion equation Omega = unvech ([0 ; q(1:3,1); 0; -q(3,1); q(2,1); 0; -q(1,1); 0],-1); dqdt(4:7,1) = 0.5*Omega*q(4:7,1); - -endfunction +endfunction Modified: trunk/octave-forge/main/mechanics/inst/core/private/drawAxis3D.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/private/drawAxis3D.m 2012-09-22 08:40:14 UTC (rev 11070) +++ trunk/octave-forge/main/mechanics/inst/core/private/drawAxis3D.m 2012-09-22 10:03:17 UTC (rev 11071) @@ -1,17 +1,17 @@ -%%copyright (c) 2011 Juan Pablocarbajal <car...@if...> -%% -%% This program is free software: youcan redistribute itand/or modify -%% it under the terms of the GNU General Public Licenseas publishedby -%% the Free Software Foundation, either version 3 of the License, or -%% any later version. -%% -%% This program is distributed in the hope that it willbe useful, -%% but WITHOUTaNY WARRANTY; without even the implied warranty of -%% MERCHANTABILITY or FITNESS FORa PARTICULAR PURPOSE. See the -%% GNU General Public License for more details. -%% -%% You should have receivedacopy of the GNU General Public License -%% along with this program. If not, see <http://www.gnu.org/licenses/>. +## Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, see <http://www.gnu.org/licenses/>. function drawAxis3D (p,E,c) for i=1:3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-22 08:40:20
|
Revision: 11070 http://octave.svn.sourceforge.net/octave/?rev=11070&view=rev Author: jpicarbajal Date: 2012-09-22 08:40:14 +0000 (Sat, 22 Sep 2012) Log Message: ----------- general: Fixing error in documentation when passing function handles to inputParser. Modified Paths: -------------- trunk/octave-forge/main/general/inst/@inputParser/inputParser.m Modified: trunk/octave-forge/main/general/inst/@inputParser/inputParser.m =================================================================== --- trunk/octave-forge/main/general/inst/@inputParser/inputParser.m 2012-09-22 08:15:06 UTC (rev 11069) +++ trunk/octave-forge/main/general/inst/@inputParser/inputParser.m 2012-09-22 08:40:14 UTC (rev 11070) @@ -75,7 +75,7 @@ ## ## ## one can create a function handle to anonymous functions for validators ## val_mat = @@(x)isvector(x) && all( x <= 1) && all(x >= 0); -## p = p.addOptional ("mat", [0 0], @@val_mat); +## p = p.addOptional ("mat", [0 0], val_mat); ## ## ## create two ParamValue type of arguments ## val_type = @@(x) ischar(x) && any(strcmp(x, @{"linear", "quadratic"@}); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-22 08:15:12
|
Revision: 11069 http://octave.svn.sourceforge.net/octave/?rev=11069&view=rev Author: paramaniac Date: 2012-09-22 08:15:06 +0000 (Sat, 22 Sep 2012) Log Message: ----------- control: support custom plot styles Modified Paths: -------------- trunk/octave-forge/main/control/devel/__time_response_2__.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-21 18:32:16 UTC (rev 11068) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-22 08:15:06 UTC (rev 11069) @@ -25,17 +25,16 @@ % function [y, t, x_arr] = __time_response_2__ (sys, resptype, plotflag, tfinal, dt, x0, sysname) function [y, t, x] = __time_response_2__ (resptype, args, sysname, plotflag) - sys_idx = cellfun (@isa, args, {"lti"}); # look for LTI models + sys_idx = find (cellfun (@isa, args, {"lti"})); # look for LTI models, 'find' needed for plot styles 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); endif - tmp = cellfun (@is_real_matrix, args); - vec_idx = find (tmp); - n_vec = length (vec_idx); - n_sys = length (sys_cell); + vec_idx = find (cellfun (@is_real_matrix, args)); # indices of vector arguments + n_vec = length (vec_idx); # number of vector arguments + n_sys = length (sys_cell); # number of LTI systems %if (n_vec >= 1) % arg = args{vec_idx(1)}; @@ -140,6 +139,7 @@ error ("time_response: invalid response type"); endswitch + style_idx = find (cellfun (@ischar, args)); outname = get (sys_cell{end}, "outname"); outname = __labels__ (outname, "y"); colororder = get (gca, "colororder"); @@ -147,7 +147,16 @@ for k = 1 : n_sys # for every system color = colororder(1+rem (k-1, rc), :); - style = {"-", "color", color}; + if (k == n_sys) + lim = numel (args); + else + lim = sys_idx(k+1); + endif + style = args(style_idx(style_idx > sys_idx(k) & style_idx <= lim)); + if (isempty (style)) + style = {"-", "color", color}; + endif + style discrete = ! ct_idx(k); if (discrete) # discrete-time system for i = 1 : p # for every output Modified: trunk/octave-forge/main/control/devel/multiplot3.m =================================================================== --- trunk/octave-forge/main/control/devel/multiplot3.m 2012-09-21 18:32:16 UTC (rev 11068) +++ trunk/octave-forge/main/control/devel/multiplot3.m 2012-09-22 08:15:06 UTC (rev 11069) @@ -3,6 +3,8 @@ figure (1) step2 (T_AH, T_opt) +figure (2) +step2 (T_AH, '-.r', T_opt, '-b') -figure (2) +figure (3) 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-21 18:32:22
|
Revision: 11068 http://octave.svn.sourceforge.net/octave/?rev=11068&view=rev Author: paramaniac Date: 2012-09-21 18:32:16 +0000 (Fri, 21 Sep 2012) Log Message: ----------- control: touch up developer makefile Modified Paths: -------------- trunk/octave-forge/main/control/devel/makefile_control.m Modified: trunk/octave-forge/main/control/devel/makefile_control.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_control.m 2012-09-21 14:04:34 UTC (rev 11067) +++ trunk/octave-forge/main/control/devel/makefile_control.m 2012-09-21 18:32:16 UTC (rev 11068) @@ -15,5 +15,6 @@ system ("make clean"); system ("make -j1 all"); system ("rm *.o"); +system ("rm *.d"); cd (homedir); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-09-21 14:04:45
|
Revision: 11067 http://octave.svn.sourceforge.net/octave/?rev=11067&view=rev Author: carandraug Date: 2012-09-21 14:04:34 +0000 (Fri, 21 Sep 2012) Log Message: ----------- image: depends on at least signal 1.2.0 for normxcorr2 Modified Paths: -------------- trunk/octave-forge/main/image/DESCRIPTION Modified: trunk/octave-forge/main/image/DESCRIPTION =================================================================== --- trunk/octave-forge/main/image/DESCRIPTION 2012-09-21 13:22:15 UTC (rev 11066) +++ trunk/octave-forge/main/image/DESCRIPTION 2012-09-21 14:04:34 UTC (rev 11067) @@ -9,7 +9,7 @@ The package also provides functions for feature extraction, image statistics, spatial and geometric transformations, morphological operations, linear filtering, and much more. -Depends: octave (>= 3.6.0), signal +Depends: octave (>= 3.6.0), signal (>= 1.2.0) Autoload: no License: GPLv3+, simplified BSD Url: http://octave.sf.net This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-09-21 13:22:21
|
Revision: 11066 http://octave.svn.sourceforge.net/octave/?rev=11066&view=rev Author: carandraug Date: 2012-09-21 13:22:15 +0000 (Fri, 21 Sep 2012) Log Message: ----------- signal: bump version for release Modified Paths: -------------- trunk/octave-forge/main/signal/DESCRIPTION trunk/octave-forge/main/signal/NEWS Modified: trunk/octave-forge/main/signal/DESCRIPTION =================================================================== --- trunk/octave-forge/main/signal/DESCRIPTION 2012-09-21 13:18:41 UTC (rev 11065) +++ trunk/octave-forge/main/signal/DESCRIPTION 2012-09-21 13:22:15 UTC (rev 11066) @@ -1,11 +1,12 @@ Name: Signal -Version: 1.1.3 -Date: 2012-05-12 +Version: 1.2.0 +Date: 2012-09-21 Author: various authors Maintainer: Octave-Forge community <oct...@li...> Title: Signal Processing. Description: Signal processing tools, including filtering, windowing and display functions. Depends: octave (>= 3.6.0), optim (>= 1.0.0), specfun, control (>= 2.2.3), general (>= 1.3.2) +## depends on specfun because of ellipke. When it moves to octave core, dependency can be removed Autoload: no License: GPLv3+, public domain Url: http://octave.sf.net Modified: trunk/octave-forge/main/signal/NEWS =================================================================== --- trunk/octave-forge/main/signal/NEWS 2012-09-21 13:18:41 UTC (rev 11065) +++ trunk/octave-forge/main/signal/NEWS 2012-09-21 13:22:15 UTC (rev 11066) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the signal package =============================================================================== -signal-1.1.4 Release Date: 2012-XX-XX Release Manager: +signal-1.2.0 Release Date: 2012-09-21 Release Manager: Carnë Draug =============================================================================== ** Improved Matlab compability for the function `fir2'. This changes include This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-21 13:18:50
|
Revision: 11065 http://octave.svn.sourceforge.net/octave/?rev=11065&view=rev Author: jpicarbajal Date: 2012-09-21 13:18:41 +0000 (Fri, 21 Sep 2012) Log Message: ----------- mechanics: fixing copyright Modified Paths: -------------- trunk/octave-forge/main/mechanics/inst/core/RBexample.m trunk/octave-forge/main/mechanics/inst/core/quatconj.m trunk/octave-forge/main/mechanics/inst/core/quatprod.m trunk/octave-forge/main/mechanics/inst/core/quatvrot.m Modified: trunk/octave-forge/main/mechanics/inst/core/RBexample.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/RBexample.m 2012-09-21 12:58:16 UTC (rev 11064) +++ trunk/octave-forge/main/mechanics/inst/core/RBexample.m 2012-09-21 13:18:41 UTC (rev 11065) @@ -1,3 +1,18 @@ +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + %% Example of a free rigid body (no torques) %% Inital orientation @@ -22,7 +37,7 @@ opt.InertiaMoment = opt.Mass*[(3/5)*h^2 + (3/20)*r^2 (3/10)*r^2 (3/5)*h^2 + (3/20)*r^2]; opt.Gravity = [0 0 -1]; sys = @(t_,x_)RBequations_rot(t_,x_,opt); - + %% Set integration tspan = [0 6]; odeopt = odeset('RelTol',1e-3,'AbsTol',1e-3,... Modified: trunk/octave-forge/main/mechanics/inst/core/quatconj.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/quatconj.m 2012-09-21 12:58:16 UTC (rev 11064) +++ trunk/octave-forge/main/mechanics/inst/core/quatconj.m 2012-09-21 13:18:41 UTC (rev 11065) @@ -1,17 +1,17 @@ -%%copyright (c) 2011 Juan Pablocarbajal <car...@if...> -%% -%% This program is free software: youcan redistribute itand/or modify -%% it under the terms of the GNU General Public Licenseas publishedby +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by %% the Free Software Foundation, either version 3 of the License, or -%% any later version. +%% (at your option) any later version. %% -%% This program is distributed in the hope that it willbe useful, -%% but WITHOUTaNY WARRANTY; without even the implied warranty of -%% MERCHANTABILITY or FITNESS FORa PARTICULAR PURPOSE. See the +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %% GNU General Public License for more details. %% -%% You should have receivedacopy of the GNU General Public License -%% along with this program. If not, see <http://www.gnu.org/licenses/>. +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- %% @deftypefn {Function File} {@var{qc} = } quatconj (@var{q}) Modified: trunk/octave-forge/main/mechanics/inst/core/quatprod.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/quatprod.m 2012-09-21 12:58:16 UTC (rev 11064) +++ trunk/octave-forge/main/mechanics/inst/core/quatprod.m 2012-09-21 13:18:41 UTC (rev 11065) @@ -1,17 +1,17 @@ -%%copyright (c) 2011 Juan Pablocarbajal <car...@if...> -%% -%% This program is free software: youcan redistribute itand/or modify -%% it under the terms of the GNU General Public Licenseas publishedby +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by %% the Free Software Foundation, either version 3 of the License, or -%% any later version. +%% (at your option) any later version. %% -%% This program is distributed in the hope that it willbe useful, -%% but WITHOUTaNY WARRANTY; without even the implied warranty of -%% MERCHANTABILITY or FITNESS FORa PARTICULAR PURPOSE. See the +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %% GNU General Public License for more details. %% -%% You should have receivedacopy of the GNU General Public License -%% along with this program. If not, see <http://www.gnu.org/licenses/>. +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- %% @deftypefn {Function File} {@var{q3} = } quatprod (@var{q1}, @var{q2}) @@ -26,4 +26,3 @@ q1(:,1).*q2(:,4) + q1(:,2).*q2(:,3) - q1(:,3).*q2(:,2) + q1(:,4).*q2(:,1) ]; endfunction - Modified: trunk/octave-forge/main/mechanics/inst/core/quatvrot.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/quatvrot.m 2012-09-21 12:58:16 UTC (rev 11064) +++ trunk/octave-forge/main/mechanics/inst/core/quatvrot.m 2012-09-21 13:18:41 UTC (rev 11065) @@ -1,17 +1,17 @@ -%%copyright (c) 2011 Juan Pablocarbajal <car...@if...> -%% -%% This program is free software: youcan redistribute itand/or modify -%% it under the terms of the GNU General Public Licenseas publishedby +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by %% the Free Software Foundation, either version 3 of the License, or -%% any later version. +%% (at your option) any later version. %% -%% This program is distributed in the hope that it willbe useful, -%% but WITHOUTaNY WARRANTY; without even the implied warranty of -%% MERCHANTABILITY or FITNESS FORa PARTICULAR PURPOSE. See the +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %% GNU General Public License for more details. %% -%% You should have receivedacopy of the GNU General Public License -%% along with this program. If not, see <http://www.gnu.org/licenses/>. +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- %% @deftypefn {Function File} {@var{vn} = } quatvrot (@var{v}, @var{q}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-09-21 12:58:22
|
Revision: 11064 http://octave.svn.sourceforge.net/octave/?rev=11064&view=rev Author: carandraug Date: 2012-09-21 12:58:16 +0000 (Fri, 21 Sep 2012) Log Message: ----------- signal: mention fixed fir1 tests on NEWS Modified Paths: -------------- trunk/octave-forge/main/signal/NEWS Modified: trunk/octave-forge/main/signal/NEWS =================================================================== --- trunk/octave-forge/main/signal/NEWS 2012-09-21 12:44:08 UTC (rev 11063) +++ trunk/octave-forge/main/signal/NEWS 2012-09-21 12:58:16 UTC (rev 11064) @@ -10,9 +10,9 @@ when invalid values are used (instead of silently adjusting them). ** Fixed failing tests for the following functions: - pei_tseng_notch - residued + fir1 pei_tseng_notch residued + ** The function `rceps' was fixed to work correctly with odd-length inputs. ** Bugfix in `xcorr2' introduced in 1.1.2 that would not accept "none" as @@ -22,8 +22,9 @@ cross-correlation. ** The following functions are new: - movingrms schtrig clustersegment + movingrms schtrig clustersegment + ** signal is no longer dependent on the image package. ** signal is now dependent on the general package. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-09-21 12:44:18
|
Revision: 11063 http://octave.svn.sourceforge.net/octave/?rev=11063&view=rev Author: carandraug Date: 2012-09-21 12:44:08 +0000 (Fri, 21 Sep 2012) Log Message: ----------- im2float: common code from im2single and im2double in private function Modified Paths: -------------- trunk/octave-forge/main/image/inst/im2double.m trunk/octave-forge/main/image/inst/im2single.m Added Paths: ----------- trunk/octave-forge/main/image/inst/private/im2float.m Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-09-21 12:23:35 UTC (rev 11062) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-09-21 12:44:08 UTC (rev 11063) @@ -37,30 +37,7 @@ ## @end deftypefn function im = im2double (im, indexed = false) - - ## Input checking (private function that is used for all im2class functions) - im_class = imconversion (nargin, "im2double", indexed, im); - - ## READ BEFORE MAKE CHANGES: - ## this function is pretty much the same as im2single. Any changes on this code - ## should most likely also be done there - - switch im_class - case "double" - ## do nothing, return the same - case {"logical", "single"} - im = double (im); - case {"uint8", "uint16"} - if (indexed) - im = double (im) + 1; - else - im = double (im) / double (intmax (im_class)); - endif - case "int16" - im = (double (im) + double (intmax (im_class)) + 1) / double (intmax ("uint16")); - otherwise - error ("unsupported image class %s", im_class); - endswitch + im = im2float ("double", nargin, im, indexed); endfunction %!assert(im2double([1 2 3]), [1 2 3]); # double returns the same Modified: trunk/octave-forge/main/image/inst/im2single.m =================================================================== --- trunk/octave-forge/main/image/inst/im2single.m 2012-09-21 12:23:35 UTC (rev 11062) +++ trunk/octave-forge/main/image/inst/im2single.m 2012-09-21 12:44:08 UTC (rev 11063) @@ -36,30 +36,7 @@ ## @end deftypefn function im = im2single (im, indexed = false) - - ## Input checking (private function that is used for all im2class functions) - im_class = imconversion (nargin, "im2single", indexed, im); - - ## READ BEFORE MAKE CHANGES: - ## this function is pretty much the same as im2double. Any changes on this code - ## should most likely also be done there - - switch im_class - case "single" - ## do nothing, return the same - case {"logical", "double"} - im = single (im); - case {"uint8", "uint16"} - if (indexed) - im = single (im) + 1; - else - im = single (im) / single (intmax (im_class)); - endif - case "int16" - im = (single (im) + single (intmax (im_class)) + 1) / single (intmax ("uint16")); - otherwise - error ("unsupported image class %s", im_class); - endswitch + im = im2float ("single", nargin, im, indexed); endfunction %!assert(im2single([1 2 3]), single([1 2 3])); # double returns the same Added: trunk/octave-forge/main/image/inst/private/im2float.m =================================================================== --- trunk/octave-forge/main/image/inst/private/im2float.m (rev 0) +++ trunk/octave-forge/main/image/inst/private/im2float.m 2012-09-21 12:44:08 UTC (rev 11063) @@ -0,0 +1,43 @@ +## Copyright (C) 2012 Carnë Draug <car...@gm...> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, see <http://www.gnu.org/licenses/>. + +## im2double and im2single are very similar so here's the common code, +## which is prety much all of it. + +function im = im2float (out_class, caller_nargin, im, indexed = false) + + ## Input checking (private function that is used for all im2class functions) + im_class = imconversion (caller_nargin, ["im2" out_class], indexed, im); + + converter = eval (["@" out_class]); + switch im_class + case {"single", "double", "logical"} + if (strcmp (im_class, out_class)) + ## do nothing, return the same + else + im = converter (im); + endif + case {"uint8", "uint16"} + if (indexed) + im = converter (im) + 1; + else + im = converter (im) / converter (intmax (im_class)); + endif + case "int16" + im = (converter (im) + converter (intmax (im_class)) + 1) / converter (intmax ("uint16")); + otherwise + error ("unsupported image class %s", im_class); + 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-21 12:23:44
|
Revision: 11062 http://octave.svn.sourceforge.net/octave/?rev=11062&view=rev Author: carandraug Date: 2012-09-21 12:23:35 +0000 (Fri, 21 Sep 2012) Log Message: ----------- fir1: fix tests (checked with matlab that it should indeed return a row) Modified Paths: -------------- trunk/octave-forge/main/signal/inst/fir1.m Modified: trunk/octave-forge/main/signal/inst/fir1.m =================================================================== --- trunk/octave-forge/main/signal/inst/fir1.m 2012-09-21 07:39:42 UTC (rev 11061) +++ trunk/octave-forge/main/signal/inst/fir1.m 2012-09-21 12:23:35 UTC (rev 11062) @@ -140,9 +140,9 @@ %!demo %! freqz(fir1(15,[0.2, 0.5], 'stop', 'noscale')); -%!assert(fir1(2, .5, 'low', @hanning, 'scale'), [0 1 0]'); -%!assert(fir1(2, .5, 'low', "hanning", 'scale'), [0 1 0]'); -%!assert(fir1(2, .5, 'low', hanning(3), 'scale'), [0 1 0]'); +%!assert(fir1(2, .5, 'low', @hanning, 'scale'), [0 1 0]); +%!assert(fir1(2, .5, 'low', "hanning", 'scale'), [0 1 0]); +%!assert(fir1(2, .5, 'low', hanning(3), 'scale'), [0 1 0]); %!assert(fir1(10,.5,'noscale'), fir1(10,.5,'low','hamming','noscale')); %!assert(fir1(10,.5,'high'), fir1(10,.5,'high','hamming','scale')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-21 07:39:51
|
Revision: 11061 http://octave.svn.sourceforge.net/octave/?rev=11061&view=rev Author: paramaniac Date: 2012-09-21 07:39:42 +0000 (Fri, 21 Sep 2012) Log Message: ----------- control: save early draft code Added Paths: ----------- trunk/octave-forge/main/control/devel/lsim2.m Added: trunk/octave-forge/main/control/devel/lsim2.m =================================================================== --- trunk/octave-forge/main/control/devel/lsim2.m (rev 0) +++ trunk/octave-forge/main/control/devel/lsim2.m 2012-09-21 07:39:42 UTC (rev 11061) @@ -0,0 +1,207 @@ +## Copyright (C) 2009, 2010, 2011 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}] =} lsim (@var{sys}, @var{u}) +## @deftypefnx{Function File} {[@var{y}, @var{t}, @var{x}] =} lsim (@var{sys}, @var{u}, @var{t}) +## @deftypefnx{Function File} {[@var{y}, @var{t}, @var{x}] =} lsim (@var{sys}, @var{u}, @var{t}, @var{x0}) +## @deftypefnx{Function File} {[@var{y}, @var{t}, @var{x}] =} lsim (@var{sys}, @var{u}, @var{t}, @var{[]}, @var{method}) +## @deftypefnx{Function File} {[@var{y}, @var{t}, @var{x}] =} lsim (@var{sys}, @var{u}, @var{t}, @var{x0}, @var{method}) +## Simulate LTI model response to arbitrary inputs. If no output arguments are given, +## the system response is plotted on the screen. +## +## @strong{Inputs} +## @table @var +## @item sys +## LTI model. System must be proper, i.e. it must not have more zeros than poles. +## @item u +## Vector or array of input signal. Needs @code{length(t)} rows and as many columns +## as there are inputs. If @var{sys} is a single-input system, row vectors @var{u} +## of length @code{length(t)} are accepted as well. +## @item t +## Time vector. Should be evenly spaced. If @var{sys} is a continuous-time system +## and @var{t} is a real scalar, @var{sys} is discretized with sampling time +## @code{tsam = t/(rows(u)-1)}. If @var{sys} is a discrete-time system and @var{t} +## is not specified, vector @var{t} is assumed to be @code{0 : tsam : tsam*(rows(u)-1)}. +## @item x0 +## Vector of initial conditions for each state. If not specified, a zero vector is assumed. +## @item method +## Discretization method for continuous-time models. Default value is zoh +## (zero-order hold). All methods from @code{c2d} are supported. +## @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. It is always evenly spaced. +## @item x +## State trajectories array. Has @code{length (t)} rows and as many columns as states. +## @end table +## +## @seealso{impulse, initial, step} +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2009 +## Version: 0.3 + +% function [y_r, t_r, x_r] = lsim (sys, u, t = [], x0 = [], method = "zoh") +function [y_r, t_r, x_r] = lsim (varargin) + + if (nargin < 2) + print_usage (); + endif + + sys_idx = cellfun (@isa, varargin, {"lti"}); # look for LTI models + sys_cell = cellfun (@ss, varargin(sys_idx), "uniformoutput", false); # convert to state-space + + if (! size_equal (sys_cell{:})) + error ("lsim: models must have equal sizes"); + endif + + vec_idx = find (cellfun (@is_real_matrix, varargin)); + n_vec = length (vec_idx); + n_sys = length (sys_cell); + + + + if (! isa (sys, "ss")) + sys = ss (sys); # sys must be proper + endif + + if (is_real_vector (u)) + u = reshape (u, [], 1); # allow row vectors for single-input systems + elseif (! is_real_matrix (u)) + error ("lsim: input signal u must be an array of real numbers"); + endif + + if (! is_real_vector (t) && ! isempty (t)) + error ("lsim: time vector t must be real or empty"); + endif + + discrete = ! isct (sys); # static gains are treated as continuous-time systems + tsam = abs (get (sys, "tsam")); # use 1 second as default if tsam is unspecified (-1) + urows = rows (u); + ucols = columns (u); + + if (discrete) # discrete system + if (isempty (t)) # lsim (sys, u) + dt = tsam; + tinitial = 0; + tfinal = tsam * (urows - 1); + elseif (length (t) == 1) # lsim (sys, u, tfinal) + dt = tsam; + tinitial = 0; + tfinal = t; + else # lsim (sys, u, t, ...) + warning ("lsim: spacing of time vector has no effect on sampling time of discrete system"); + dt = tsam; + tinitial = t(1); + tfinal = t(end); + endif + else # continuous system + if (isempty (t)) # lsim (sys, u, [], ...) + error ("lsim: invalid time vector"); + elseif (length (t) == 1) # lsim (sys, u, tfinal, ...) + dt = t / (urows - 1); + tinitial = 0; + tfinal = t; + else # lsim (sys, u, t, ...) + dt = t(2) - t(1); # assume that t is regularly spaced + tinitial = t(1); + tfinal = t(end); + endif + sys = c2d (sys, dt, method); # convert to discrete-time model + endif + + [A, B, C, D] = ssdata (sys); + + n = rows (A); # number of states + m = columns (B); # number of inputs + p = rows (C); # number of outputs + + t = reshape (tinitial : dt : tfinal, [], 1); # time vector + trows = length (t); + + if (urows != trows) + error ("lsim: input vector u must have %d rows", trows); + endif + + if (ucols != m) + error ("lsim: input vector u must have %d columns", m); + endif + + ## preallocate memory + y = zeros (trows, p); + x_arr = zeros (trows, n); + + ## initial conditions + if (isempty (x0)) + x0 = zeros (n, 1); + elseif (n != length (x0) || ! is_real_vector (x0)) + error ("lsim: x0 must be a vector with %d elements", n); + endif + + x = reshape (x0, [], 1); # make sure that x is a column vector + + ## simulation + for k = 1 : trows + y(k, :) = C * x + D * u(k, :).'; + x_arr(k, :) = x; + x = A * x + B * u(k, :).'; + endfor + + if (nargout == 0) # plot information + str = ["Linear Simulation Results of ", inputname(1)]; + outname = get (sys, "outname"); + outname = __labels__ (outname, "y_"); + if (discrete) # discrete system + for k = 1 : p + subplot (p, 1, k); + stairs (t, y(:, k)); + grid ("on"); + if (k == 1) + title (str); + endif + ylabel (sprintf ("Amplitude %s", outname{k})); + endfor + xlabel ("Time [s]"); + else # continuous system + for k = 1 : p + subplot (p, 1, k); + plot (t, y(:, k)); + grid ("on"); + if (k == 1) + title (str); + endif + ylabel (sprintf ("Amplitude %s", outname{k})); + endfor + xlabel ("Time [s]"); + endif + else # return values + y_r = y; + t_r = t; + x_r = x_arr; + endif + +endfunction + + +## TODO: add test cases \ 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-21 06:33:45
|
Revision: 11060 http://octave.svn.sourceforge.net/octave/?rev=11060&view=rev Author: paramaniac Date: 2012-09-21 06:33:39 +0000 (Fri, 21 Sep 2012) Log Message: ----------- control: touch up acknowledgments in user manual Modified Paths: -------------- trunk/octave-forge/main/control/devel/pdfdoc/control.tex Modified: trunk/octave-forge/main/control/devel/pdfdoc/control.tex =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2012-09-21 05:46:21 UTC (rev 11059) +++ trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2012-09-21 06:33:39 UTC (rev 11060) @@ -77,10 +77,13 @@ him to achieve his goals. I am particularly grateful to Luca Favatella who introduced me to Octave development as well as discussed and revised my early draft code with great patience. My continued support from the -@acronym{FHNW} University of Applied Sciences of Northwestern Switzerland, +@acronym{FHNW} University of Applied Sciences Northwestern Switzerland, where I could work on the control package as a semester project, has also been important. Furthermore, I thank the @acronym{SLICOT} authors Peter Benner, Vasile Sima and Andras Varga for their advice. +Finally, I appreciate the feedback, bug reports and patches I have received +from various people. The names of all contributors should be listed in the +@acronym{NEWS} file. @sp 5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-21 05:46:27
|
Revision: 11059 http://octave.svn.sourceforge.net/octave/?rev=11059&view=rev Author: paramaniac Date: 2012-09-21 05:46:21 +0000 (Fri, 21 Sep 2012) Log Message: ----------- control: save minor changes 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-20 14:11:11 UTC (rev 11058) +++ trunk/octave-forge/main/control/devel/__time_response_2__.m 2012-09-21 05:46:21 UTC (rev 11059) @@ -105,14 +105,13 @@ ## 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) -%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}, "uniformoutput", false); case "step" [y, x] = cellfun (@__step_response__, sys_dt_cell, t, "uniformoutput", false); case "impulse" @@ -128,15 +127,15 @@ case "initial" str = "Response to Initial Conditions"; cols = 1; - yfinal = zeros (p, 1); + ## yfinal = zeros (p, 1); case "step" str = "Step Response"; cols = m; - yfinal = dcgain (sys_cell{1}); + ## yfinal = dcgain (sys_cell{1}); case "impulse" str = "Impulse Response"; cols = m; - yfinal = zeros (p, m); + ## yfinal = zeros (p, m); otherwise error ("time_response: invalid response type"); endswitch @@ -173,12 +172,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); - 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 + ##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: <car...@us...> - 2012-09-20 14:11:22
|
Revision: 11058 http://octave.svn.sourceforge.net/octave/?rev=11058&view=rev Author: carandraug Date: 2012-09-20 14:11:11 +0000 (Thu, 20 Sep 2012) Log Message: ----------- copyright_fix.pl: check if path was given and warn otherwise Modified Paths: -------------- trunk/octave-forge/admin/copyright_fix.pl Modified: trunk/octave-forge/admin/copyright_fix.pl =================================================================== --- trunk/octave-forge/admin/copyright_fix.pl 2012-09-19 22:21:29 UTC (rev 11057) +++ trunk/octave-forge/admin/copyright_fix.pl 2012-09-20 14:11:11 UTC (rev 11058) @@ -240,4 +240,8 @@ if ($verbose) { say "Added copyright notice to '$_'"; } } -find(\&fix, @ARGV); # this call does all the recursive work +if (@ARGV) { + find(\&fix, @ARGV); # this call does all the recursive work +} else { + warn ("No path was specified, no changes were made"); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 22:21:35
|
Revision: 11057 http://octave.svn.sourceforge.net/octave/?rev=11057&view=rev Author: jpicarbajal Date: 2012-09-19 22:21:29 +0000 (Wed, 19 Sep 2012) Log Message: ----------- geometry: Ported all content files Modified Paths: -------------- trunk/octave-forge/main/geometry/PKG_ADD trunk/octave-forge/main/geometry/PKG_DEL Modified: trunk/octave-forge/main/geometry/PKG_ADD =================================================================== --- trunk/octave-forge/main/geometry/PKG_ADD 2012-09-19 22:20:26 UTC (rev 11056) +++ trunk/octave-forge/main/geometry/PKG_ADD 2012-09-19 22:21:29 UTC (rev 11057) @@ -1,5 +1,6 @@ %1 -dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs","geom3d"}; +dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs",... + "geom3d","meshes3d"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); arch = cstrcat (octave_config_info ("canonical_host_type"), Modified: trunk/octave-forge/main/geometry/PKG_DEL =================================================================== --- trunk/octave-forge/main/geometry/PKG_DEL 2012-09-19 22:20:26 UTC (rev 11056) +++ trunk/octave-forge/main/geometry/PKG_DEL 2012-09-19 22:21:29 UTC (rev 11057) @@ -1,5 +1,6 @@ %1 -dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs","geom3d"}; +dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs",... + "geom3d","meshes3d"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); arch = cstrcat (octave_config_info ("canonical_host_type"), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 22:20:32
|
Revision: 11056 http://octave.svn.sourceforge.net/octave/?rev=11056&view=rev Author: jpicarbajal Date: 2012-09-19 22:20:26 +0000 (Wed, 19 Sep 2012) Log Message: ----------- geometry: Ported all content files Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-09-19 22:10:39 UTC (rev 11055) +++ trunk/octave-forge/main/geometry/INDEX 2012-09-19 22:20:26 UTC (rev 11056) @@ -159,17 +159,25 @@ triangleGrid 3D Descriptive geom3d_Contents + meshes3d_Contents angles3d boxes3d circles3d + lines3d + planes3d + points3d + polygons3d + vectors3d 3D Points anglePoints3d +Geometric graphs descriptive + graphs_Contents Geometric graphs creation - delaunayGraph.m - knnGraph.m - voronoi2d.m + delaunayGraph + knnGraph + voronoi2d Geometric graphs visualization - drawGraph.m + drawGraph Geometric graphs manipulation Input @svg/svg Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-09-19 22:10:39 UTC (rev 11055) +++ trunk/octave-forge/main/geometry/NEWS 2012-09-19 22:20:26 UTC (rev 11056) @@ -4,8 +4,9 @@ =============================================================================== * Added Functions anglePoints3d.m angles3d.m boxes3d.m geom3d_Contents.m + lines3d.m planes3d.m points3d.m polygons3d.m + vectors3d.m graphs_Contents.m meshes3d_Contents.m - * Bug Fixes: - drawArrow.m was not working due to porting errors. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 22:10:47
|
Revision: 11055 http://octave.svn.sourceforge.net/octave/?rev=11055&view=rev Author: jpicarbajal Date: 2012-09-19 22:10:39 +0000 (Wed, 19 Sep 2012) Log Message: ----------- geometry: Ported all content files Added Paths: ----------- trunk/octave-forge/main/geometry/inst/geom3d/lines3d.m trunk/octave-forge/main/geometry/inst/geom3d/planes3d.m trunk/octave-forge/main/geometry/inst/geom3d/points3d.m trunk/octave-forge/main/geometry/inst/geom3d/polygons3d.m trunk/octave-forge/main/geometry/inst/geom3d/vectors3d.m trunk/octave-forge/main/geometry/inst/graphs/graphs_Contents.m trunk/octave-forge/main/geometry/inst/meshes3d/ trunk/octave-forge/main/geometry/inst/meshes3d/meshes3d_Contents.m Added: trunk/octave-forge/main/geometry/inst/geom3d/lines3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/lines3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/lines3d.m 2012-09-19 22:10:39 UTC (rev 11055) @@ -0,0 +1,49 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} lines3d () +##LINES3D Description of functions operating on 3D lines +## +## A 3D Line is represented by a 3D point (its origin) and a 3D vector +## (its direction): +## LINE = [X0 Y0 Z0 DX DY DZ]; +## +## @seealso{createLine3d, transformLine3d, distancePointLine3d, linePosition3d +## intersectLinePlane, distanceLines3d, clipLine3d, drawLine3d} +## @end deftypefn +function lines3d() + + help lines3d + +endfunction Added: trunk/octave-forge/main/geometry/inst/geom3d/planes3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/planes3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/planes3d.m 2012-09-19 22:10:39 UTC (rev 11055) @@ -0,0 +1,51 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} planes3d () +##PLANES3D Description of functions operating on 3D planes +## +## Planes are represented by a 3D point (the plane origin) and 2 direction +## vectors, which should not be colinear. +## PLANE = [X0 Y0 Z0 DX1 DY1 DZ1 DX2 DY2 DZ2]; +## +## @seealso{createPlane, medianPlane, normalizePlane, +## planeNormal, planePosition, dihedralAngle, +## intersectPlanes, projPointOnPlane, isBelowPlane, +## intersectLinePlane, intersectEdgePlane, distancePointPlane, drawPlane3d} +## @end deftypefn +function planes3d(varargin) + + help planes3d + +endfunction Added: trunk/octave-forge/main/geometry/inst/geom3d/points3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/points3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/points3d.m 2012-09-19 22:10:39 UTC (rev 11055) @@ -0,0 +1,50 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} points3d () +##POINTS3D Description of functions operating on 3D points +## +## Points are represented by their 3 Cartesian coordinates: +## P = [X Y Z]; +## +## Arrays of points consist in N*3 arrays, each row being a point. +## +## @seealso{isCoplanar, distancePoints, anglePoints3d, angleSort3d, sphericalAngle, +## sph2cart2, cart2sph2, cart2cyl, cyl2cart, transformPoint3d, clipPoints3d} +## @end deftypefn +function points3d() + + help points3d + +endfunction Added: trunk/octave-forge/main/geometry/inst/geom3d/polygons3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/polygons3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/polygons3d.m 2012-09-19 22:10:39 UTC (rev 11055) @@ -0,0 +1,51 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} polygons3d () +## POLYGONS3D Description of functions operating on 3D polygons +## +## A 3D polygon is simply a set of 3D points (called vertices) which are +## assumed to be located in the same plane. +## Several functions are provided for computing basic geometrical +## parameters (centroid, angles), or intersections with lines or planes. +## +## @seealso{polygon3dNormalAngle, polygonCentroid3d, clipConvexPolygon3dHP +## intersectLinePolygon3d, intersectLineTriangle3d, intersectRayPolygon3d +## drawPolygon3d, drawPolyline3d, fillPolygon3d} +## @end deftypefn +function polygons3d() + + help polygons3d + +endfunction Added: trunk/octave-forge/main/geometry/inst/geom3d/vectors3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/vectors3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/vectors3d.m 2012-09-19 22:10:39 UTC (rev 11055) @@ -0,0 +1,53 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} vectors3d () +##VECTORS3D Description of functions operating on 3D vectors +## +## Vectors are represented by their 3 Cartesian coordinates: +## V = [VX VY VZ]; +## +## List of vectors are represented by N*3 arrays, with the coordinates of +## each vector on a row. +## +## +## @seealso{vectorNorm3d, normalizeVector3d, vectorAngle3d isParallel3d, +## isPerpendicular3d, createTranslation3d} +## @end deftypefn + +function vectors3d(varargin) + + help vectors3d + +endfunction Added: trunk/octave-forge/main/geometry/inst/graphs/graphs_Contents.m =================================================================== --- trunk/octave-forge/main/geometry/inst/graphs/graphs_Contents.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/graphs/graphs_Contents.m 2012-09-19 22:10:39 UTC (rev 11055) @@ -0,0 +1,142 @@ +## Copyright (C) 2011 David Legland <dav...@gr...> +## All rights reserved. +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1 Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimer. +## 2 Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS'' +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +## ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +## -*- texinfo -*- +## @deftypefn {Function File} graphs_Contents () +## GRAPHS Simple Toolbox for manipulating Geometric Graphs +## Version 0.5 11-Apr-2010 . +## +## The aim of this package is to provides functions to easily create, +## modify and display geometric graphs (geometric in a sense position +## of vertices is kept in memory). +## +## Graph structure is represented by at least two arrays: +## * NODES, which contains coordinates of each vertex +## * EDGES, which contains indices of start and end vertex. +## +## Others arrays may sometimes be used: +## * FACES, which contains indices of vertices of each face (either a +## double array, or a cell array) +## * CELLS, which contains indices of faces of each cell. +## +## An alternative representation is to use a structure, with fields: +## * edges +## * faces +## * cells +## corresponding to the data described above. +## +## Note that topological description of 2D graph is entirely contained in +## EDGES array, and that NODES array is used only to display graph +## +## Caution: this type of data structure is easy to create and to manage, +## but may be very inefficient for some algorithms. +## +## Graphs are usually considered as non-oriented in this package. +## +## +## Graph creation +## knnGraph - Create the k-nearest neighbors graph of a set of points +## delaunayGraph - Graph associated to Delaunay triangulation of input points +## euclideanMST - Build euclidean minimal spanning tree of a set of points +## prim_mst - Minimal spanning tree by Prim's algorithm +## +## Create graph from images +## imageGraph - Create equivalent graph of a binary image +## boundaryGraph - Get boundary of image as a graph +## gcontour2d - Creates contour graph of a 2D binary image. +## gcontour3d - Create contour graph of a 3D binary image. +## vectorize - Transform a binary skeleton into a graph (nodes and edges) +## +## Graph information +## grNodeDegree - Degree of a node in a (undirected) graph +## grNodeInnerDegree - Inner degree of a node in a graph +## grNodeOuterDegree - Outer degree of a node in a graph +## grNeighborNodes - Find adjacent nodes of a given node +## grNeighborEdges - Find adjacent edges of a given node +## grOppositeNode - Return opposite node in an edge +## grLabel - Associate a label to each connected component of the graph +## +## Graph management (low level operations) +## grRemoveNode - Remove a node in a graph +## grRemoveNodes - Remove several nodes in a graph +## grRemoveEdge - Remove an edge in a graph. +## grRemoveEdges - Remove several edges from a graph +## +## Graph processing (general applications) +## mergeGraphs - Merge two graphs, by adding nodes, edges and faces lists. +## grMergeNodes - Merge two (or more) nodes in a graph. +## grMergeMultipleNodes - Simplify a graph by merging multiple nodes +## grMergeMultipleEdges - Remove all edges sharing the same extremities +## grSimplifyBranches - Replace branches of a graph by single edges +## +## Filtering operations on Graph +## grMean - Compute mean from neihgbours +## grMedian - Compute median from neihgbours +## grDilate - Morphological dilation on graph +## grErode - Morphological erosion on graph +## grClose - Morphological closing on graph +## grOpen - Morphological opening on graph +## +## Geodesic operations +## grPropagateDistance - Propagates distances from a vertex to other vertices +## grVertexEccentricity - Eccentricity of vertices in the graph +## graphDiameter - Diameter of a graph +## graphPeripheralVertices - Peripheral vertices of a graph +## graphCenter - Center of a graph +## graphRadius - Radius of a graph +## grFindGeodesicPath - Find a geodesic path between two nodes in the graph +## grFindMaximalLengthPath - Find a path that maximizes sum of edge weights +## +## Operations for geometric graphs +## grMergeNodeClusters - Merge cluster of connected nodes in a graph +## grMergeNodesMedian - Replace several nodes by their median coordinate +## clipGraph - Clip a graph with a rectangular area +## addSquareFace - Add a (square) face defined from its vertices to a graph +## grFaceToPolygon - Compute the polygon corresponding to a graph face +## graph2Contours - Convert a graph to a set of contour curves +## +## Voronoi Graphs +## voronoi2d - Compute a voronoi diagram as a graph structure +## boundedVoronoi2d - Return a bounded voronoi diagram as a graph structure +## centroidalVoronoi2d - Create a 2D Centroidal Voronoi Tesselation +## cvtUpdate - Update germs of a CVT with given points +## cvtIterate - Update germs of a CVT using random points with given density +## +## Graph display +## drawGraph - Draw a graph, given as a set of vertices and edges +## drawGraphEdges - Draw edges of a graph +## drawGraphFaces - Draw faces of a graph +## drawDigraph - Draw a directed graph, given as a set of vertices and edges +## drawDirectedEdges - Draw edges with arrow indicating direction +## drawEdgeLabels - Draw values associated to graph edges +## drawNodeLabels - Draw values associated to graph nodes +## drawSquareMesh - Draw a 3D square mesh given as a graph +## patchGraph - Transform 3D graph (mesh) into a patch handle +## +## @end deftypefn + +function graphs_Contents() + + help graphs_Contents + +endfunction Added: trunk/octave-forge/main/geometry/inst/meshes3d/meshes3d_Contents.m =================================================================== --- trunk/octave-forge/main/geometry/inst/meshes3d/meshes3d_Contents.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/meshes3d/meshes3d_Contents.m 2012-09-19 22:10:39 UTC (rev 11055) @@ -0,0 +1,115 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} meshes3d_Contents () +## MESHES3D 3D Surface Meshes +## Version 1.0 21-Mar-2011 . +## +## Creation, vizualization, and manipulation of 3D surface meshes or +## polyhedra. +## +## Meshes and Polyhedra are represented by a couple of variables {V, F}: +## V: Nv-by-3 array of vertices: [x1 y1 z1; ... ; xn yn zn]; +## F: is either a NF-by-3 or NF-by-4 array containing reference for +## vertices of each face, or a NF-by-1 cell array, where each cell is an +## array containing a variable number of node indices. +## For some functions, the array E of edges is needed. It consists in a +## NE-by-2 array containing indices of source and target vertices. +## +## The library provides function to create basic polyhedric meshes (the 5 +## platonic solids, plus few others), as well as functions to perform +## basic computations (surface area, normal angles, face centroids...). +## The 'MengerSponge' structure is an example of mesh that is not simply +## connected (multiple tunnels in the structure). +## +## The drawMesh function is mainly a wrapper to the Matlab 'patch' +## function, allowing passing arguments more quickly. +## +## Example +## % create a soccer ball mesh and display it +## [n e f] = createSoccerBall; +## drawMesh(n, f, 'faceColor', 'g', 'linewidth', 2); +## axis equal; +## +## +## General functions +## meshFace - Return the vertex indices of a face in a mesh +## computeMeshEdges - Computes edges array from face array +## meshEdgeFaces - Compute index of faces adjacent to each edge of a mesh +## faceCentroids - Compute centroids of a mesh faces +## faceNormal - Compute normal vector of faces in a 3D mesh +## +## Measures on meshes +## meshSurfaceArea - Surface area of a polyhedral mesh +## trimeshSurfaceArea - Surface area of a triangular mesh +## meshEdgeLength - Lengths of edges of a polygonal or polyhedral mesh +## meshDihedralAngles - Dihedral at edges of a polyhedal mesh +## polyhedronNormalAngle - Compute normal angle at a vertex of a 3D polyhedron +## polyhedronMeanBreadth - Mean breadth of a convex polyhedron +## +## Basic processing +## triangulateFaces - Convert face array to an array of triangular faces +## meshReduce - Merge coplanar faces of a polyhedral mesh +## minConvexHull - Return the unique minimal convex hull of a set of 3D points +## polyhedronSlice - Intersect a convex polyhedron with a plane. +## checkMeshAdjacentFaces - Check if adjacent faces of a mesh have similar orientation +## clipMeshVertices - Clip vertices of a surfacic mesh and remove outer faces +## clipConvexPolyhedronHP - Clip a convex polyhedron by a plane +## +## Typical polyhedra +## polyhedra - Index of classical polyhedral meshes +## createCube - Create a 3D mesh representing the unit cube +## createOctahedron - Create a 3D mesh representing an octahedron +## createCubeOctahedron - Create a 3D mesh representing a cube-octahedron +## createIcosahedron - Create a 3D mesh representing an Icosahedron. +## createDodecahedron - Create a 3D mesh representing a dodecahedron +## createTetrahedron - Create a 3D mesh representing a tetrahedron +## createRhombododecahedron - Create a 3D mesh representing a rhombododecahedron +## createTetrakaidecahedron - Create a 3D mesh representing a tetrakaidecahedron +## +## Less typical polyhedra +## createSoccerBall - Create a 3D mesh representing a soccer ball +## createMengerSponge - Create a cube with an inside cross removed +## steinerPolytope - Create a steiner polytope from a set of vectors +## +## Drawing functions +## drawFaceNormals - Draw normal vector of each face in a mesh +## drawMesh - Draw a 3D mesh defined by vertices and faces +## @end deftypefn + +function meshes3d_Contents () + + help meshes3d_Contents + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 21:18:36
|
Revision: 11054 http://octave.svn.sourceforge.net/octave/?rev=11054&view=rev Author: jpicarbajal Date: 2012-09-19 21:18:26 +0000 (Wed, 19 Sep 2012) Log Message: ----------- geometry: Starting port of geom3d Added Paths: ----------- trunk/octave-forge/main/geometry/inst/geom3d/ trunk/octave-forge/main/geometry/inst/geom3d/anglePoints3d.m trunk/octave-forge/main/geometry/inst/geom3d/angles3d.m trunk/octave-forge/main/geometry/inst/geom3d/boxes3d.m trunk/octave-forge/main/geometry/inst/geom3d/circles3d.m trunk/octave-forge/main/geometry/inst/geom3d/geom3d_Contents.m Added: trunk/octave-forge/main/geometry/inst/geom3d/anglePoints3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/anglePoints3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/anglePoints3d.m 2012-09-19 21:18:26 UTC (rev 11054) @@ -0,0 +1,106 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{alpha} =} anglePoints3d (@var{p1}, @var{p2}) +## @deftypefnx {Function File} {@var{alpha} =} anglePoints3d (@var{p1}, @var{p2},@var{p3}) +## @deftypefnx {Function File} {@var{alpha} =} anglePoints3d (@var{pts}) +## Compute angle between three 3D points +## +## @var{alpha} = anglePoints3d(P1, P2) +## Computes angle (P1, O, P2), in radians, between 0 and PI. +## +## @var{alpha} = anglePoints3d(P1, P2, P3) +## Computes angle (P1, P2, P3), in radians, between 0 and PI. +## +## @var{alpha} = anglePoints3d(PTS) +## PTS is a 3x3 or 2x3 array containing coordinate of points. +## +## @seealso{points3d, angles3d} +## @end deftypefn + +function alpha = anglePoints3d(varargin) + + p2 = [0 0 0]; + if length(varargin)==1 + pts = varargin{1}; + if size(pts, 1)==2 + p1 = pts(1,:); + p0 = [0 0 0]; + p2 = pts(2,:); + else + p1 = pts(1,:); + p0 = pts(2,:); + p2 = pts(3,:); + end + elseif length(varargin)==2 + p1 = varargin{1}; + p0 = [0 0 0]; + p2 = varargin{2}; + elseif length(varargin)==3 + p1 = varargin{1}; + p0 = varargin{2}; + p2 = varargin{3}; + end + + # ensure all data have same size + n1 = size(p1, 1); + n2 = size(p2, 1); + n0 = size(p0, 1); + if n1~=n2 + if n1==1 + p1 = repmat(p1, [n2 1]); + elseif n2==1 + p2 = repmat(p2, [n1 1]); + else + error('Arguments P1 and P2 must have the same size'); + end + end + if n1~=n0 + if n1==1 + p1 = repmat(p1, [n0 1]); + elseif n0==1 + p0 = repmat(p0, [n1 1]); + else + error('Arguments P1 and P0 must have the same size'); + end + end + + # normalized vectors + p1 = normalizeVector(p1-p0); + p2 = normalizeVector(p2-p0); + + # compute angle + alpha = acos(dot(p1, p2, 2)); + +endfunction Added: trunk/octave-forge/main/geometry/inst/geom3d/angles3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/angles3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/angles3d.m 2012-09-19 21:18:26 UTC (rev 11054) @@ -0,0 +1,75 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} angles3d () +##ANGLES3D Conventions for manipulating angles in 3D +## +## Contrary to the plane, there are no oriented angles in 3D. Angles +## between lines or between planes are comprised between 0 and PI. +## +## Spherical angles +## Spherical angles are defined by 2 angles: +## * THETA, the colatitude, representing angle with Oz axis (between 0 and +## PI) +## * PHI, the azimut, representing angle with Ox axis of horizontal +## projection of the direction (between 0 and 2*PI) +## +## Spherical coordinates can be represented by THETA, PHI, and the +## distance RHO to the origin. +## +## Euler angles +## Some functions for creating rotations use Euler angles. They follow the +## ZYX convention in the global reference system, that is eqivalent to the +## XYZ convention ine a local reference system. +## Euler angles are given by a triplet of angles [PHI THETA PSI] that +## represents the succession of 3 rotations: +## * rotation around X by angle PSI ("roll") +## * rotation around Y by angle THETA ("pitch") +## * rotation around Z by angle PHI ("yaw") +## +## In this library, euler angles are given in degrees. The functions that +## use euler angles use the keyword 'Euler' in their name. +## +## +## @seealso{cart2sph2, sph2cart2, cart2sph2d, sph2cart2d +## anglePoints3d, angleSort3d, sphericalAngle, randomAngle3d +## dihedralAngle, polygon3dNormalAngle, eulerAnglesToRotation3d +## rotation3dAxisAndAngle, rotation3dToEulerAngles} +## @end deftypefn + +function angles3d() + + help angles3d + +endfunction Added: trunk/octave-forge/main/geometry/inst/geom3d/boxes3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/boxes3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/boxes3d.m 2012-09-19 21:18:26 UTC (rev 11054) @@ -0,0 +1,57 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} boxes3d () +## BOXES3D Description of functions operating on 3D boxes +## +## A box defined by its coordinate extents: +## BOX = [XMIN XMAX YMIN YMAX ZMIN ZMAX]. +## +## Example +## # Draw a polyhedron together with its bounding box +## [n e f]= createIcosahedron; +## drawPolyhedron(n, f); +## hold on; +## drawBox3d(point3dBounds(n)) +## +## +## @seealso{point3dBounds, box3dVolume, drawBox3d +## intersectBoxes3d, mergeBoxes3d, randomPointInBox3d} +## @end deftypefn + +function boxes3d() + + help boxes3d + +endfunction Added: trunk/octave-forge/main/geometry/inst/geom3d/circles3d.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/circles3d.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/circles3d.m 2012-09-19 21:18:26 UTC (rev 11054) @@ -0,0 +1,54 @@ +## Copyright (c) 2011, INRA +## 2004-2011, David Legland <dav...@gr...> +## 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} circles3d () +##CIRCLES3D Description of functions operating on 3D circles +## +## Circles are represented by a center, a radius and a 3D angle +## representing the normal of the plane containing the circle. +## C = [xc yc zc R theta phi psi]. +## THETA is the colatitude of the normal, in degrees, between 0 and 180 +## PHI is the azimut of the normal, in degrees, between 0 and 360 +## PSI is the proper rotation of the circle around the normal, between 0 +## and 360 degrees +## The parameter PSI is used to locate a point on the 3D circle. +## +## @seealso{circle3dOrigin, circle3dPosition, circle3dPoint, intersectPlaneSphere +## drawCircle3d, drawCircleArc3d, drawEllipse3d} +## @end deftypefn +function circles3d () + + help circles3d + +endfunction Added: trunk/octave-forge/main/geometry/inst/geom3d/geom3d_Contents.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom3d/geom3d_Contents.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom3d/geom3d_Contents.m 2012-09-19 21:18:26 UTC (rev 11054) @@ -0,0 +1,237 @@ +## Copyright (c) 2011, INRA +## 2007-2011, David Legland <dav...@gr...> +## 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## +## All rights reserved. +## (simplified BSD License) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer in the documentation +## and/or other materials provided with the distribution. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +## POSSIBILITY OF SUCH DAMAGE. +## +## The views and conclusions contained in the software and documentation are +## those of the authors and should not be interpreted as representing official +## policies, either expressed or implied, of copyright holder. + +## -*- texinfo -*- +## @deftypefn {Function File} geom3d_Contents () +## GEOM3D Geometry 3D Toolbox +## Version 1.0 21-Mar-2011 . +## +## Creation, transformations, algorithms and visualization of geometrical +## 3D primitives, such as points, lines, planes, polyhedra, circles and +## spheres. +## +## Euler Angles are defined as follow: +## PHI is the azimut, i.e. the angle of the projection on horizontal plane +## with the Ox axis, with value beween 0 and 180 degrees. +## THETA is the latitude, i.e. the angle with the Oz axis, with value +## between -90 and +90 degrees. +## PSI is the 'roll', i.e. the rotation around the (PHI, THETA) direction, +## with value in degrees +## See also the 'angles3d' page. +## +## Base format for primitives: +## Point: [x0 y0 z0] +## Vector: [dx dy dz] +## Line: [x0 y0 z0 dx dy dz] +## Edge: [x1 y1 z1 x2 y2 z2] +## Plane: [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2] +## Sphere: [x0 y0 z0 R] +## Circle: [x0 y0 z0 R PHI THETA PSI] (origin+center+normal+'roll'). +## Cylinder: [X1 Y1 Z1 X2 Y2 Z2 R] +## Box: [xmin xmax ymin ymax zmin zmax]. Used for clipping shapes. +## +## Polygons are represented by N-by-3 array of points, the last point is +## not necessarily the same as the first one. Points must be coplanar. +## +## Meshes and Polyhedra are represented by a couple of variables {V, F}: +## V: N-by-3 array of vetrtices: [x1 y1 z1; ... ;xn yn zn]; +## F: is either a [Nf*3] or [Nf*4] array containing reference for vertices +## of each face, or a [Nf*1] cell array, where each cell is an array +## containing a variable number of node indices. +## For some functions, the array E of edges is needed. It consists in a +## Ne-by-2 array containing indices of source and target vertices. +## +## +## 3D Points +## points3d - Description of functions operating on 3D points +## midPoint3d - Middle point of two 3D points or of a 3D edge +## isCoplanar - Tests input points for coplanarity in 3-space. +## transformPoint3d - Transform a point with a 3D affine transform +## distancePoints3d - Compute euclidean distance between pairs of 3D Points +## clipPoints3d - Clip a set of points by a box +## drawPoint3d - Draw 3D point on the current axis. +## +## 3D Vectors +## vectors3d - Description of functions operating on 3D vectors +## transformVector3d - Transform a vector with a 3D affine transform +## normalizeVector3d - Normalize a 3D vector to have norm equal to 1 +## vectorNorm3d - Norm of a 3D vector or of set of 3D vectors +## vectorAngle3d - Angle between two 3D vectors +## isParallel3d - Check parallelism of two 3D vectors +## isPerpendicular3d - Check orthogonality of two 3D vectors +## +## Angles +## angles3d - Conventions for manipulating angles in 3D +## anglePoints3d - Compute angle between three 3D points +## sphericalAngle - Compute angle between points on the sphere +## angleSort3d - Sort 3D coplanar points according to their angles in plane +## randomAngle3d - Return a 3D angle uniformly distributed on unit sphere +## +## Coordinate transforms +## sph2cart2 - Convert spherical coordinates to cartesian coordinates +## cart2sph2 - Convert cartesian coordinates to spherical coordinates +## cart2sph2d - Convert cartesian coordinates to spherical coordinates in degrees +## sph2cart2d - Convert spherical coordinates to cartesian coordinates in degrees +## cart2cyl - Convert cartesian to cylindrical coordinates +## cyl2cart - Convert cylindrical to cartesian coordinates +## +## 3D Lines and Edges +## lines3d - Description of functions operating on 3D lines +## createLine3d - Create a line with various inputs. +## transformLine3d - Transform a 3D line with a 3D affine transform +## clipLine3d - Clip a line with a box and return an edge +## midPoint3d - Middle point of two 3D points or of a 3D edge +## distancePointLine3d - Euclidean distance between 3D point and line +## distanceLines3d - Minimal distance between two 3D lines +## linePosition3d - Return the position of a 3D point on a 3D line +## drawEdge3d - Draw 3D edge in the current Window +## drawLine3d - Draw a 3D line on the current axis +## +## Planes +## planes3d - Description of functions operating on 3D planes +## createPlane - Create a plane in parametrized form +## normalizePlane - Normalize parametric representation of a plane +## intersectPlanes - Return intersection line between 2 planes in space +## intersectLinePlane - Return intersection point between a plane and a line +## intersectEdgePlane - Return intersection point between a plane and a edge +## distancePointPlane - Signed distance betwen 3D point and plane +## projPointOnPlane - Return the orthogonal projection of a point on a plane +## isBelowPlane - Test whether a point is below or above a plane +## medianPlane - Create a plane in the middle of 2 points +## planeNormal - Compute the normal to a plane +## planePosition - Compute position of a point on a plane +## planePoint - Compute 3D position of a point in a plane +## dihedralAngle - Compute dihedral angle between 2 planes +## drawPlane3d - Draw a plane clipped in the current window +## +## 3D Polygons and curves +## polygons3d - Description of functions operating on 3D polygons +## polygonCentroid3d - Centroid (or center of mass) of a polygon +## triangleArea3d - Area of a 3D triangle +## polygon3dNormalAngle - Normal angle at a vertex of the 3D polygon +## intersectLinePolygon3d - Intersection point of a 3D line and a 3D polygon +## intersectLineTriangle3d - Intersection point of a 3D line and a 3D triangle +## intersectRayPolygon3d - Intersection point of a 3D ray and a 3D polygon +## clipConvexPolygon3dHP - Clip a convex 3D polygon with Half-space +## drawPolygon3d - Draw a 3D polygon specified by a list of vertices +## drawPolyline3d - Draw a 3D polyline specified by a list of vertices +## fillPolygon3d - Fill a 3D polygon specified by a list of points +## +## 3D circles and ellipses +## circles3d - Description of functions operating on 3D circles +## circle3dPosition - Return the angular position of a point on a 3D circle +## circle3dPoint - Coordinates of a point on a 3D circle from its position +## circle3dOrigin - Return the first point of a 3D circle +## drawCircle3d - Draw a 3D circle +## drawCircleArc3d - Draw a 3D circle arc +## drawEllipse3d - Draw a 3D ellipse +## +## Spheres +## spheres - Description of functions operating on 3D spheres +## createSphere - Create a sphere containing 4 points +## intersectLineSphere - Return intersection points between a line and a sphere +## intersectPlaneSphere - Return intersection circle between a plane and a sphere +## drawSphere - Draw a sphere as a mesh +## drawSphericalTriangle - Draw a triangle on a sphere +## +## Smooth surfaces +## inertiaEllipsoid - Inertia ellipsoid of a set of 3D points +## intersectLineCylinder - Compute intersection points between a line and a cylinder +## revolutionSurface - Create a surface of revolution from a planar curve +## surfaceCurvature - Curvature on a surface from angle and principal curvatures +## drawEllipsoid - Draw a 3D ellipsoid +## drawTorus - Draw a torus (3D ring) +## drawCylinder - Draw a cylinder +## drawSurfPatch - Draw a 3D surface patch, with 2 parametrized surfaces +## +## Bounding boxes management +## boxes3d - Description of functions operating on 3D boxes +## point3dBounds - Bounding box of a set of 3D points +## intersectBoxes3d - Intersection of two 3D bounding boxes +## mergeBoxes3d - Merge 3D boxes, by computing their greatest extent +## box3dVolume - Volume of a 3-dimensional box +## randomPointInBox3d - Generate random point(s) within a 3D box +## drawBox3d - Draw a 3D box defined by coordinate extents +## +## Geometric transforms +## transforms3d - Conventions for manipulating 3D affine transforms +## createTranslation3d - Create the 4x4 matrix of a 3D translation +## createScaling3d - Create the 4x4 matrix of a 3D scaling +## createRotationOx - Create the 4x4 matrix of a 3D rotation around x-axis +## createRotationOy - Create the 4x4 matrix of a 3D rotation around y-axis +## createRotationOz - Create the 4x4 matrix of a 3D rotation around z-axis +## createBasisTransform3d - Compute matrix for transforming a basis into another basis +## eulerAnglesToRotation3d - Convert 3D Euler angles to 3D rotation matrix +## rotation3dToEulerAngles - Extract Euler angles from a rotation matrix +## createRotation3dLineAngle - Create rotation around a line by an angle theta +## rotation3dAxisAndAngle - Determine axis and angle of a 3D rotation matrix +## recenterTransform3d - Change the fixed point of an affine 3D transform +## composeTransforms3d - Concatenate several space transformations +## +## Various drawing Functions +## drawGrid3d - Draw a 3D grid on the current axis +## drawAxis3d - Draw a coordinate system and an origin +## drawAxisCube - Draw a colored cube representing axis orientation +## drawCube - Draw a 3D centered cube, eventually rotated +## drawCuboid - Draw a 3D cuboid, eventually rotated +## +## +## Credits: +## * function isCoplanar was originally written by Brett Shoelson. +## * Songbai Ji enhanced file intersectPlaneLine (6/23/2006). +## +## @end deftypefn + +function geom3d_Contents () + + help('geom3d_Contents'); + + ## In development: + ## clipPolygon3dHP - clip a 3D polygon with Half-space + ## drawPartialPatch - draw surface patch, with 2 parametrized surfaces + + + ## Deprecated: + ## intersectPlaneLine - return intersection between a plane and a line + ## translation3d - return 4x4 matrix of a 3D translation + ## scale3d - return 4x4 matrix of a 3D scaling + ## rotationOx - return 4x4 matrix of a rotation around x-axis + ## rotationOy - return 4x4 matrix of a rotation around y-axis + ## rotationOz - return 4x4 matrix of a rotation around z-axis + ## scaling3d - return 4x4 matrix of a 3D scaling + ## vecnorm3d - compute norm of vector or of set of 3D vectors + ## normalize3d - normalize a 3D vector + ## drawCurve3d - draw a 3D curve specified by a list of points + ## createEulerAnglesRotation - Create a rotation matrix from 3 euler angles + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 21:17:46
|
Revision: 11053 http://octave.svn.sourceforge.net/octave/?rev=11053&view=rev Author: jpicarbajal Date: 2012-09-19 21:17:37 +0000 (Wed, 19 Sep 2012) Log Message: ----------- geometry: Starting port of geom3d Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS trunk/octave-forge/main/geometry/PKG_ADD trunk/octave-forge/main/geometry/PKG_DEL Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-09-19 09:23:37 UTC (rev 11052) +++ trunk/octave-forge/main/geometry/INDEX 2012-09-19 21:17:37 UTC (rev 11053) @@ -157,6 +157,13 @@ hexagonalGrid squareGrid triangleGrid +3D Descriptive + geom3d_Contents + angles3d + boxes3d + circles3d +3D Points + anglePoints3d Geometric graphs creation delaunayGraph.m knnGraph.m Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-09-19 09:23:37 UTC (rev 11052) +++ trunk/octave-forge/main/geometry/NEWS 2012-09-19 21:17:37 UTC (rev 11053) @@ -1,8 +1,11 @@ Summary of important user-visible changes for releases of the geometry package =============================================================================== -geometry-1.5.1 Release Date: 2012-xx-xx Release Manager: Juan Pablo Carbajal +geometry-1.6.0 Release Date: 2012-xx-xx Release Manager: Juan Pablo Carbajal =============================================================================== +* Added Functions + anglePoints3d.m angles3d.m boxes3d.m geom3d_Contents.m + * Bug Fixes: - drawArrow.m was not working due to porting errors. Modified: trunk/octave-forge/main/geometry/PKG_ADD =================================================================== --- trunk/octave-forge/main/geometry/PKG_ADD 2012-09-19 09:23:37 UTC (rev 11052) +++ trunk/octave-forge/main/geometry/PKG_ADD 2012-09-19 21:17:37 UTC (rev 11053) @@ -1,5 +1,5 @@ %1 -dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs"}; +dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs","geom3d"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); arch = cstrcat (octave_config_info ("canonical_host_type"), @@ -15,21 +15,15 @@ % The package is not installed yet [pkg_folder dep_folder] = pkg ("prefix"); pkg_folder = [pkg_folder strcat(filesep(),{pp{end-1:end}}){:} ]; -% dep_folder = [dep_folder strcat(filesep(),{pp{end-1:end}}){:} ]; if strcmp (arch , pp{end}) %% If we are in Architecture dependent folder add from outside pkg_folder = strsplit (pkg_folder,filesep (), true); pkg_folder = [strcat(filesep(),{pkg_folder{1:end-1}}){:}]; -% dep_folder = strsplit (dep_folder,filesep (), true); -% dep_folder = [strcat(filesep(),{dep_folder{1:end-1}}){:}]; end else pkg_folder = pkg_data{1}.dir; -% dep_folder = pkg_data{1}.archprefix; end -%dep_folder = [dep_folder filesep arch]; - if (! exist (fullfile (dirname, "inst"), "dir")) %% Installing for ii=1:length (dirlist) @@ -43,9 +37,7 @@ addpath ([ dirname "/inst/" dirlist{ii}]) endfor endif -%addpath (dep_folder) warning('off', 'Octave:fopen-file-in-path'); clear dirlist dirname pp arch pkg_folder clear global_packages ii installed_pkgs_lst local_packages pkg_data -%dep_folder Modified: trunk/octave-forge/main/geometry/PKG_DEL =================================================================== --- trunk/octave-forge/main/geometry/PKG_DEL 2012-09-19 09:23:37 UTC (rev 11052) +++ trunk/octave-forge/main/geometry/PKG_DEL 2012-09-19 21:17:37 UTC (rev 11053) @@ -1,5 +1,5 @@ %1 -dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs"}; +dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs","geom3d"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); arch = cstrcat (octave_config_info ("canonical_host_type"), @@ -14,21 +14,15 @@ % The package is not installed yet [pkg_folder dep_folder] = pkg ("prefix"); pkg_folder = [pkg_folder strcat(filesep(),{pp{end-1:end}}){:} ]; -% dep_folder = [dep_folder strcat(filesep(),{pp{end-1:end}}){:} ]; if strcmp (arch , pp{end}) %% If we are in Architecture dependent folder add from outside pkg_folder = strsplit (pkg_folder,filesep (), true); pkg_folder = [strcat(filesep(),{pkg_folder{1:end-1}}){:}]; -% dep_folder = strsplit (dep_folder,filesep (), true); -% dep_folder = [strcat(filesep(),{dep_folder{1:end-1}}){:}]; end else pkg_folder = pkg_data{1}.dir; -% dep_folder = pkg_data{1}.archprefix; end -%dep_folder = [dep_folder filesep arch]; - if (! exist (fullfile (dirname, "inst"), "dir")) ## Run this if the package is installed for ii=1:length (dirlist) @@ -40,7 +34,5 @@ rmpath ([ dirname "/inst/" dirlist{ii}]) endfor endif -%rmpath (dep_folder); clear dirlist dirname pp arch pkg_folder -%dep_folder This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 09:23:44
|
Revision: 11052 http://octave.svn.sourceforge.net/octave/?rev=11052&view=rev Author: jpicarbajal Date: 2012-09-19 09:23:37 +0000 (Wed, 19 Sep 2012) Log Message: ----------- statistics: slight improvement to dendogram. Output args and figure handling still needs work. Modified Paths: -------------- trunk/octave-forge/main/statistics/inst/dendogram.m Modified: trunk/octave-forge/main/statistics/inst/dendogram.m =================================================================== --- trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-18 22:39:31 UTC (rev 11051) +++ trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-19 09:23:37 UTC (rev 11052) @@ -14,7 +14,7 @@ %% along with this program. If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- -%% @deftypefn {Function File} {@var{h} = } dendogram (@var{tree}) +%% @deftypefn {Function File} {@var{p} = } dendogram (@var{tree}) %% Plots a dendogram using the output of function @command{linkage}. %% %% TODO: Return handle to lines to set properties @@ -23,7 +23,7 @@ %% @seealso{linkage} %% @end deftypefn -function h = dendogram (tree) +function p = dendogram (tree) [m d] = size (tree); if d != 3 @@ -70,10 +70,10 @@ tmp = line (x', tree(:,[3 3])'); % plot vertical lines - for i=1:nc - [ind,~] = find (tree(:,1:2)==i); - tmp = line (p([i; i],1),[p(i,2); tree(ind,3)]); - end + [~,tf] = ismember (1:nc, tree(:,1:2)); + [ind,~] = ind2sub (size (tree(:,1:2)), tf); + y = [p(1:nc,2) tree(ind,3)]; + tmp = line ([p(1:nc,1) p(1:nc,1)]',y'); xticks = 1:n; xl_txt = arrayfun (@num2str, labels,"uniformoutput",false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-18 22:39:37
|
Revision: 11051 http://octave.svn.sourceforge.net/octave/?rev=11051&view=rev Author: jpicarbajal Date: 2012-09-18 22:39:31 +0000 (Tue, 18 Sep 2012) Log Message: ----------- statistics:Adding demo to dendogram. Modified Paths: -------------- trunk/octave-forge/main/statistics/inst/dendogram.m Modified: trunk/octave-forge/main/statistics/inst/dendogram.m =================================================================== --- trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-18 22:31:39 UTC (rev 11050) +++ trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-18 22:39:31 UTC (rev 11051) @@ -85,4 +85,12 @@ %!demo %! y = [4 5; 2 6; 3 7; 8 9; 1 10]; %! y(:,3) = 1:5; +%! figure(gcf); clf; %! dendogram(y); + +%!demo +%! v = 2*rand(30,1)-1; +%! d = abs(v(:,1)-v(:,1)'); +%! y = linkage (squareform(d,"tovector")); +%! figure(gcf); clf; +%! dendogram(y); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-18 22:31:50
|
Revision: 11050 http://octave.svn.sourceforge.net/octave/?rev=11050&view=rev Author: jpicarbajal Date: 2012-09-18 22:31:39 +0000 (Tue, 18 Sep 2012) Log Message: ----------- statistics:fixing dendogram function. Oder of leafs implemented. Modified Paths: -------------- trunk/octave-forge/main/statistics/inst/dendogram.m Modified: trunk/octave-forge/main/statistics/inst/dendogram.m =================================================================== --- trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-18 21:35:42 UTC (rev 11049) +++ trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-18 22:31:39 UTC (rev 11050) @@ -17,14 +17,12 @@ %% @deftypefn {Function File} {@var{h} = } dendogram (@var{tree}) %% Plots a dendogram using the output of function @command{linkage}. %% -%% TODO: This function needs your help to be finished! Leafs must be ordered to -%% prevent corssing of edges. +%% TODO: Return handle to lines to set properties +%% TODO: Rescale the plot automatically base don data. +%% %% @seealso{linkage} %% @end deftypefn -## TODO -# Order leafs nodes to avoid edge crossing. - function h = dendogram (tree) [m d] = size (tree); @@ -38,49 +36,27 @@ % Vector with the horizontal and vertical position of each cluster p = zeros (nc,2); -##### This is an ugly hack and is a partial solution. If you know how to oder -##### the leafs do it. Please do not copy from dendogram.m of Mathworks! + labels = zeros (n,1); - %% Order the leafs - % find which clusters contain th eleafs - tf = ismember (tree(:,1:2),1:n); - [idx_i,idx_j] = find (tf); - ind0 = find(tf(:)); - - % Assign a position between 1:n to the leafs according to clustering - % I am trying to avoid crossings. Better way? sure!. - i = 1; - j = 0; - while j < n - - % If the current leaf hasn't a position assigned, assign one. - if p(tree(idx_i(i),idx_j(i)),1) == 0 - j+=1; - p(tree(idx_i(i),idx_j(i)),1) = j; + %% Ordering by depth-first search + nodecount = 0; + nodes_to_visit = nc+1; + while !isempty(nodes_to_visit) + currentnode = nodes_to_visit(1); + nodes_to_visit(1) = []; + if currentnode > n + node = currentnode - n; + nodes_to_visit = [tree(node,[2 1]) nodes_to_visit]; end - % Check if the current cluster has another leaf. If it has and the leaf - % doesn't have a position, assign one. - next = tree(idx_i(i),setdiff(1:2,idx_j(i))); - if next <= n && p(next,1) == 0 - j+=1; - p(next,1) = j; + if currentnode <= n && p(currentnode,1) == 0 + nodecount +=1; + p(currentnode,1) = nodecount; + labels(nodecount) = currentnode; end - % Find the id of the current cluster and check if any other cluster - % that will be merged with this one has a leaf. - c_id = idx_i(i) + n; - [idx,~] = find (tree(:,1:2)==c_id); - idx2 = find (tree(idx,1:2)<=n); - if ~isempty (idx2) && p(tree(idx,idx2),1) == 0 - j+=1; - p(tree(idx,idx2),1) = j; - end - i+=1; end -##### End of the hack - % Compute the horizontal position, begin-end % and vertical position of all clusters. for i = 1:m @@ -89,9 +65,7 @@ x(i,1:2) = p(tree(i,1:2),1); end - - - clf + figure(gcf) % plot horizontal lines tmp = line (x', tree(:,[3 3])'); @@ -102,7 +76,7 @@ end xticks = 1:n; - xl_txt = arrayfun (@num2str, tree(:,1:2)(ind0),"uniformoutput",false); + xl_txt = arrayfun (@num2str, labels,"uniformoutput",false); set (gca,"xticklabel",xl_txt,"xtick",xticks); axis ([0.5 n+0.5 0 max(tree(:,3))+0.1*min(tree(:,3))]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-18 21:35:48
|
Revision: 11049 http://octave.svn.sourceforge.net/octave/?rev=11049&view=rev Author: jpicarbajal Date: 2012-09-18 21:35:42 +0000 (Tue, 18 Sep 2012) Log Message: ----------- statistics:adding dendogram function. Working but not finshed. Modified Paths: -------------- trunk/octave-forge/main/statistics/INDEX trunk/octave-forge/main/statistics/NEWS trunk/octave-forge/main/statistics/inst/linkage.m Added Paths: ----------- trunk/octave-forge/main/statistics/inst/dendogram.m Modified: trunk/octave-forge/main/statistics/INDEX =================================================================== --- trunk/octave-forge/main/statistics/INDEX 2012-09-18 18:43:56 UTC (rev 11048) +++ trunk/octave-forge/main/statistics/INDEX 2012-09-18 21:35:42 UTC (rev 11049) @@ -57,6 +57,7 @@ normplot histfit repanova + dendogram Models hmmestimate hmmgenerate hmmviterbi Hypothesis testing Modified: trunk/octave-forge/main/statistics/NEWS =================================================================== --- trunk/octave-forge/main/statistics/NEWS 2012-09-18 18:43:56 UTC (rev 11048) +++ trunk/octave-forge/main/statistics/NEWS 2012-09-18 21:35:42 UTC (rev 11049) @@ -3,7 +3,7 @@ ** The following functions are new: - regress_gp + regress_gp dendogram ** The interface of the following functions has been modified: Added: trunk/octave-forge/main/statistics/inst/dendogram.m =================================================================== --- trunk/octave-forge/main/statistics/inst/dendogram.m (rev 0) +++ trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-18 21:35:42 UTC (rev 11049) @@ -0,0 +1,114 @@ +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{h} = } dendogram (@var{tree}) +%% Plots a dendogram using the output of function @command{linkage}. +%% +%% TODO: This function needs your help to be finished! Leafs must be ordered to +%% prevent corssing of edges. +%% @seealso{linkage} +%% @end deftypefn + +## TODO +# Order leafs nodes to avoid edge crossing. + +function h = dendogram (tree) + + [m d] = size (tree); + if d != 3 + error ("Input data must be a tree as returned by function linkage.") + end + n = m + 1; + + nc = max(tree(:,1:2)(:)); + + % Vector with the horizontal and vertical position of each cluster + p = zeros (nc,2); + +##### This is an ugly hack and is a partial solution. If you know how to oder +##### the leafs do it. Please do not copy from dendogram.m of Mathworks! + + %% Order the leafs + % find which clusters contain th eleafs + tf = ismember (tree(:,1:2),1:n); + [idx_i,idx_j] = find (tf); + ind0 = find(tf(:)); + + % Assign a position between 1:n to the leafs according to clustering + % I am trying to avoid crossings. Better way? sure!. + i = 1; + j = 0; + while j < n + + % If the current leaf hasn't a position assigned, assign one. + if p(tree(idx_i(i),idx_j(i)),1) == 0 + j+=1; + p(tree(idx_i(i),idx_j(i)),1) = j; + end + + % Check if the current cluster has another leaf. If it has and the leaf + % doesn't have a position, assign one. + next = tree(idx_i(i),setdiff(1:2,idx_j(i))); + if next <= n && p(next,1) == 0 + j+=1; + p(next,1) = j; + end + + % Find the id of the current cluster and check if any other cluster + % that will be merged with this one has a leaf. + c_id = idx_i(i) + n; + [idx,~] = find (tree(:,1:2)==c_id); + idx2 = find (tree(idx,1:2)<=n); + if ~isempty (idx2) && p(tree(idx,idx2),1) == 0 + j+=1; + p(tree(idx,idx2),1) = j; + end + i+=1; + end + +##### End of the hack + + % Compute the horizontal position, begin-end + % and vertical position of all clusters. + for i = 1:m + p(n+i,1) = mean (p(tree(i,1:2),1)); + p(n+i,2) = tree(i,3); + x(i,1:2) = p(tree(i,1:2),1); + end + + + + clf + % plot horizontal lines + tmp = line (x', tree(:,[3 3])'); + + % plot vertical lines + for i=1:nc + [ind,~] = find (tree(:,1:2)==i); + tmp = line (p([i; i],1),[p(i,2); tree(ind,3)]); + end + + xticks = 1:n; + xl_txt = arrayfun (@num2str, tree(:,1:2)(ind0),"uniformoutput",false); + set (gca,"xticklabel",xl_txt,"xtick",xticks); + axis ([0.5 n+0.5 0 max(tree(:,3))+0.1*min(tree(:,3))]); + +endfunction + +%!demo +%! y = [4 5; 2 6; 3 7; 8 9; 1 10]; +%! y(:,3) = 1:5; +%! dendogram(y); Modified: trunk/octave-forge/main/statistics/inst/linkage.m =================================================================== --- trunk/octave-forge/main/statistics/inst/linkage.m 2012-09-18 18:43:56 UTC (rev 11048) +++ trunk/octave-forge/main/statistics/inst/linkage.m 2012-09-18 21:35:42 UTC (rev 11049) @@ -34,8 +34,8 @@ ## cluster and numbering those from 1 to n. Then it merges two ## clusters, chosen according to @var{method}, to create a new cluster ## 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 +## a single cluster numbered 2(n-1). Row k of the +## (m-1)x3 output matrix relates to cluster n+k: 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. |