%		TECTORIAL MEMBRANE RESONANCE PROFILES
%
%	The transfer function characteristics of the tectorial membrane
%	for the frequency set  Hz=100·[1, 2, 4, 8, 16, 32, 64, 128, 200] 
%	are shown.
% 


TM=[];
AMPL=[];
X=[];
PHAS=[];
XMIN=[];
IMAX=[];

x=(1:300)/300;
Hz=100*[1, 2, 4, 8, 16, 32, 64, 128, 200]; 
Omega=2*pi*Hz;
iOmega = sqrt(-1)*Omega;

L=length(Omega);
for i=[1:L], 
	[res, xmin, imax]  = tmres(x, Omega(i));
	AMPL=[AMPL,abs(res(:))];
	PHAS=[PHAS, angle(iOmega(i)*res(:))];
	X=[X,x(:)];
	XMIN=[XMIN, xmin];
	IMAX=[IMAX, imax];
end

Z=zeros(size(XMIN));
U=ones(size(XMIN));
figure(1)
subplot(211)
plot(X, AMPL, XMIN, U);
title('TM transfer function absolute values');
ylabel('Amplitude'); 
subplot(212)
plot(X, PHAS, XMIN, -pi/2*U);
title('TM transfer function phases');
ylabel('Phase [rad]')
xlabel('Fractional distance from stapes');	