Overview
Comment:Global parameter passing.
Proper error handling.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 622ba119af6b835986b54d73efa54a62c7f9aabe63527975338624147c272259
User & Date: gawthrop@users.sourceforge.net on 1996-08-24 14:23:00
Other Links: branch diff | manifest | tags
Context
1996-08-24
14:27:29
Global parameters. check-in: 32159655ca user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:23:00
Global parameter passing.
Proper error handling.
check-in: 622ba119af user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:22:23
Put in a ; to avoid excessive log output. check-in: 9252d5aab2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/dm2fr_m from [5075822501] to [4b24bde3b0].

11
12
13
14
15
16
17




18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$




## Revision 1.5  1996/08/15 16:23:02  peter
## Now uses W in place of w for consistancy with time responses.
##
## Revision 1.4  1996/08/15 11:52:42  peter
## Now creats a number of versions:
## fr 	complex frequency response
## lmfr 	log  magnitude of fr







>
>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1996/08/16 14:26:07  peter
## Fixed multi-output bug.
## Made sure that u0 is ok.
##
## Revision 1.5  1996/08/15 16:23:02  peter
## Now uses W in place of w for consistancy with time responses.
##
## Revision 1.4  1996/08/15 11:52:42  peter
## Now creats a number of versions:
## fr 	complex frequency response
## lmfr 	log  magnitude of fr
47
48
49
50
51
52
53
54


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
then
  PARAMS='W=logspace(-1,2,100); u0=zeros(nu,1); u0(1)=1;'
  echo Using default parameter $PARAMS
else
  PARAMS=$2;
fi

$MATRIX << EOF > dm2fr_m.log



  [nx,ny,nu,nz,nyz] = $1_def;
  $PARAMS

  %Defaults
  if exist('W')==0
    W = logspace(-1,2,100)';
  end;

  if exist('u0')==0
    u0 = zeros(nu,1);
    u0(1) = 1;
  end;

  [n,m]=size(W);
  if m>n
    W=W';
  end;

  [A,B,C,D,E] = $1_dm($1_numpar)
  fr = dm2fr(A,B,C,D,E,W,u0)
  lw = log10(W);
  lmfr = log10(abs(fr));
  pfr = angle(fr)*180/pi;

% Complex frequency response
  write_matrix([W fr], '$1_fr');








|
>
>



















|
|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
then
  PARAMS='W=logspace(-1,2,100); u0=zeros(nu,1); u0(1)=1;'
  echo Using default parameter $PARAMS
else
  PARAMS=$2;
fi

$MATRIX << EOF > dm2fr_m.log 2>mtt_error

  $1_numpar;

  [nx,ny,nu,nz,nyz] = $1_def;
  $PARAMS

  %Defaults
  if exist('W')==0
    W = logspace(-1,2,100)';
  end;

  if exist('u0')==0
    u0 = zeros(nu,1);
    u0(1) = 1;
  end;

  [n,m]=size(W);
  if m>n
    W=W';
  end;

  [A,B,C,D,E] = $1_dm;
  fr = dm2fr(A,B,C,D,E,W,u0);
  lw = log10(W);
  lmfr = log10(abs(fr));
  pfr = angle(fr)*180/pi;

% Complex frequency response
  write_matrix([W fr], '$1_fr');

101
102
103
104
105
106
107
108
















  nic = [im(:,1) re(:,1)];
  for i = 2:ny
    nic = [nic im(:,i) re(:,i)]
  end;
  write_matrix(nic, '$1_nifr');

EOF

























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
  nic = [im(:,1) re(:,1)];
  for i = 2:ny
    nic = [nic im(:,i) re(:,i)]
  end;
  write_matrix(nic, '$1_nifr');

EOF

# Test for errors and print if any
err_length=$(wc -c <mtt_error)
if [ $err_length != "0" ]
then
  echo MTT has failed with the following errors '...'
  cat mtt_error
  exit 1
else
  exit 0
fi







MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]