Home > matlabpr > wmodel.m

wmodel

PURPOSE ^

wmodel.m --- Terminated W-delay line demo.

SYNOPSIS ^

function PJ = wmodel(Uext,Y1,Y2,N,YN,fIDX);

DESCRIPTION ^

 wmodel.m --- Terminated W-delay line demo.

 This function demonstrates the terminated W-delay line consisting of N
 W-nodes, connected by W-lines of equal admittance Y2, as shown in Figure 2
 (the third port of W-node N1 is omitted). The excitation signal Uext is
 connected to N1. Y1 and YN are termination admittances. The junction pressure
 PJ is returned. Except W-nodes N1 and NN, the junction pressures are obtained
 from delay lines. Optional <fIDX> flag shows an animation in figure(fIDX).

 Excitation Examples: 
 Uext = [1 zeros(1,399)]; % Impulse
 Uext = [hamming(10)' zeros(1,390)]; % A smooth excitation signal

 Demo Examples:
 PW = wmodel(Uext,.10,1,50,.10); % Non-inverting terminations.
 PW = wmodel(Uext,5,1,50,10);    % Inverting terminations.
 PW = wmodel(Uext,.10,1,50,1);   % Admittance-matched termination (no
                                   reflection from the right).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function PJ = wmodel(Uext,Y1,Y2,N,YN,fIDX);
0002 % wmodel.m --- Terminated W-delay line demo.
0003 %
0004 % This function demonstrates the terminated W-delay line consisting of N
0005 % W-nodes, connected by W-lines of equal admittance Y2, as shown in Figure 2
0006 % (the third port of W-node N1 is omitted). The excitation signal Uext is
0007 % connected to N1. Y1 and YN are termination admittances. The junction pressure
0008 % PJ is returned. Except W-nodes N1 and NN, the junction pressures are obtained
0009 % from delay lines. Optional <fIDX> flag shows an animation in figure(fIDX).
0010 %
0011 % Excitation Examples:
0012 % Uext = [1 zeros(1,399)]; % Impulse
0013 % Uext = [hamming(10)' zeros(1,390)]; % A smooth excitation signal
0014 %
0015 % Demo Examples:
0016 % PW = wmodel(Uext,.10,1,50,.10); % Non-inverting terminations.
0017 % PW = wmodel(Uext,5,1,50,10);    % Inverting terminations.
0018 % PW = wmodel(Uext,.10,1,50,1);   % Admittance-matched termination (no
0019 %                                   reflection from the right).
0020 
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Matlab -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 %% Author          : Cumhur.Erkut@erase.hut.fi
0023 %% Created On      : Wed Jun 30 12:33:22 2004
0024 %% Last Modified By: Cumhur.Erkut@erase.hut.fi
0025 %% Last Modified On: Wed Jun 30 13:13:05 2004
0026 %% Update Count    : 43
0027 %% Reference       : Digital Waveguides versus Finite Difference Structures:
0028 %%                   Equivalence and Mixed Modeling, Matti Karjalainen and
0029 %%                   Cumhur Erkut. EURASIP J. of Applied Signal Processing,
0030 %%                   Volume 2004, Number 7, pp. 978-989, 15 June 2004.
0031 %%                   http://asp.hindawi.com/volume-2004/S1110865704401176.html
0032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0033 
0034 % ERROR CHECK
0035   error(nargchk(5,6,nargin));
0036   if nargin == 5
0037       fIDX = 0;
0038   end
0039 %%%%%%%%%%%%%%%%%%%% SIMULATION PARAMETERS %%%%%%%%%%%%%%%%%%%%
0040  MAXSTEP = length(Uext);
0041  Umax = max(Uext);
0042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0043 
0044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0045 % -----------------  INITIALIZATION  --------------------------
0046  % INITIALLY RELAXED STATES
0047    P1 = 0; PN = 0; P1m = 0; PNp = 0;
0048    Pm = zeros(1,N-1);
0049    Pp = zeros(1,N-1);
0050 % -------------------------------------------------------------
0051 
0052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0053 % -----------------    RECURSION     --------------------------
0054   for n = 1:MAXSTEP 
0055     
0056     % CALCULATE THE JUNCTION PRESSURES
0057     P1 = 1/(Y1+Y2)*(Uext(n) + 2* Y2 * Pp(1));
0058     PN = 1/(Y2+YN)*( 2* Y2 * Pm(N-1));
0059     PJ = [P1 Pm(1:N-2)+Pp(2:N-1) PN];
0060 
0061     % CALCULATE THE DELAY INPUTS
0062     P1m = P1 - Pp(1);
0063     PNp = PN - Pm(N-1);
0064     
0065     % % -------------    PLOT    -------------------
0066     if fIDX
0067       figure(fIDX);clf;
0068       set(gcf,'Renderer','OpenGL');
0069 
0070       % Junction Pressure
0071       h = plot(1:N,PJ);set(h,'LineWidth',2);
0072       grid on;
0073       set(gca,'XLim',[1 N],...
0074               'YLim',[-1.1*Umax 1.1*Umax],...
0075               'FontSize',14,...
0076               'FontName','TimesNewRoman');
0077       h = xlabel('Position k'); 
0078           ylabel('Pressure P_{J,k}');
0079           set(h,'VerticalAlignment','middle')
0080           title('W-model')
0081       drawnow;
0082     end
0083 
0084     % UPDATE DELAY LINES
0085     Pm = [P1m Pm(1:N-2)];
0086     Pp = [Pp(2:N-1) PNp];
0087     
0088   end
0089

Generated on Thu 01-Jul-2004 15:38:41 by m2html © 2003