]> Creatis software - CreaPhase.git/blob - octave_packages/ocs-0.1.3/sbn/Minductors.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / ocs-0.1.3 / sbn / Minductors.m
1 ## Copyright (C) 2006,2007,2008  Carlo de Falco            
2 ##
3 ## This file is part of:
4 ## OCS - A Circuit Simulator for Octave
5 ##
6 ## OCS is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation.
9 ##
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program (see the file LICENSE); if not,
17 ## see <http://www.gnu.org/licenses/>.
18 ##
19 ## author: Carlo de Falco <cdf _AT_ users.sourceforge.net> 
20
21 ## -*- texinfo -*-
22 ##
23 ## @deftypefn{Function File} @
24 ## {[@var{a},@var{b},@var{c}]=}Minductors(@var{string},@var{parameters},@
25 ## @var{parameternames},@var{extvar},@var{intvar},@var{t})
26 ##
27 ## SBN file implementing models for inductors.
28 ##
29 ## @var{string} is used to select among models. Parameters are listed
30 ## as inner items. Possible models are:
31 ##
32 ## @enumerate
33 ## @item @var{string} = "LIN" (Linear inductor model)
34 ## @itemize @minus
35 ## @item L -> inductance value
36 ## @end itemize
37 ## @end enumerate
38 ##
39 ## See the @cite{IFF file format specifications} for details about 
40 ## the output structures.
41 ##
42 ## @seealso{prs_iff,asm_initialize_system,asm_build_system}
43 ## @end deftypefn
44
45 function [a,b,c] = Minductors (string,parameters,parameternames,extvar,intvar,t)
46
47   if isempty(intvar)
48     intvar = [0 0];
49   endif
50
51   switch string 
52       
53     case "LIN"
54       for ii=1:length(parameternames)
55         eval([parameternames{ii} "=" num2str(parameters(ii)) ";"])      
56       endfor
57       
58       phi = intvar(1);
59       jl  = intvar(2);
60
61       a = [0 0 0 0; 
62            0 0 0 0; 
63            0 0 1 0; 
64            0 0 0 0];
65
66       b = [0 0 0 1; 
67            0 0 0 -1; 
68            -1 1 0 0; 
69            0 0 1 -L];
70
71       c = [0 0 0 0]';
72     otherwise
73       error (["unknown section:" string])
74   endswitch
75
76 endfunction
77