ADDED mttroot/mtt/bin/trans/dm2fr_m Index: mttroot/mtt/bin/trans/dm2fr_m ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/dm2fr_m @@ -0,0 +1,41 @@ +#! /bin/sh + + ###################################### + ##### Model Transformation Tools ##### + ###################################### + +# Bourne shell script: dm2fr_m2dat + +# Transformation: descriptor matrix to frequency response + +# Copyright (c) P.J.Gawthrop, 1996. + +############################################################### +## Version control history +############################################################### +## $Id$ +## $Log$ +############################################################### + +echo Creating $1_fr.dat + +$MATRIX << EOF | awk '$1 !~ /[A-Za-cf-z]/ && NF>0 {print} ' >$1_fr.dat + + W = logspace(-1,2,100); + [A,B,C,D,E] = $1_dm; + fr = dm2fr(A,B,C,D,E,W); + + rfr = real(fr); + ifr = imag(fr); + + [Ny,Nu]=size(D); + NN = Ny*Nu; + + xy = [rfr(:,1), ifr(:,1)]; + for i=2:NN + xy = [xy rfr(:,i) ifr(:,i)]; + end; +xy + +EOF + ADDED mttroot/mtt/bin/trans/dm2ir_m2dat Index: mttroot/mtt/bin/trans/dm2ir_m2dat ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/dm2ir_m2dat @@ -0,0 +1,40 @@ +#! /bin/sh + + ###################################### + ##### Model Transformation Tools ##### + ###################################### + +# Bourne shell script: dat2ps + +# Tramsforms descriptor matrix rep to frequency response dat. + + +# Copyright (c) P.J.Gawthrop, 1996. + +############################################################### +## Version control history +############################################################### +## $Id$ +## $Log$ +############################################################### + +echo Creating $1_ir.dat + +$MATRIX << EOF | awk '$1 !~ /[A-Za-z]/ && NF>0 {print} ' >$1_ir.dat + + tmax=2; tstep=tmax/100; + T = [0:tstep:tmax]'; + [A,B,C,D,E] = $1_dm; + y = dm2ir(A,B,C,D,E,T); + + [Ny,Nu]=size(D); + NN = Ny*Nu; + + xy = [T y(:,1)]; + for i=2:NN + xy = [xy T y(:,i)]; + end; +xy + +EOF + ADDED mttroot/mtt/bin/trans/m/dm2fr.m Index: mttroot/mtt/bin/trans/m/dm2fr.m ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/m/dm2fr.m @@ -0,0 +1,26 @@ +function fr = dm2fr(A,B,C,D,E,W) +% fr = dm2fr(A,B,C,D,E,W) +% Descriptor matrix to frequency response. +% A,B,C,D,E - descriptor matrices +% W vector of frequency points + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %% Version control history +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %% $Id$ +% %% $Log$ +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +N = length(W); +[Ny,Nu] = size(D); +NN=Ny*Nu; + +fr = zeros(N,NN); +i = 0; +for w = W + i = i+1; + FR = C*( (E*j*w - A) \ B ) + D; + fr(i,:) = reshape(FR,1,NN); +end; +