% Exercise 5: Optimal design of the absorber using Techniques of Fixed Points 
clc
clear
%
% Primary system data
m1=1;
k1=400000;
ksi1=0;
c1=ksi1*2*m1*sqrt(k1/m1);
mu=0.1;
m2=mu*m1
%
% Frequency band of interest
omega1=2*pi*0;
omega2=2*pi*200;
omega=omega1:0.5:omega2;
%
% Receptance of the primary system
for iomeg=1:length(omega)
    beta(iomeg)=omega(iomeg)/sqrt(k1/m1);
    H1(iomeg)=1./(-m1*(omega(iomeg))^2+k1+2*m1*ksi1*sqrt(k1/m1)*omega(iomeg)*i);
end
%
%subplot(2,1,1)
plot(beta,abs(H1),'k-')
axis([0.5 1.5 0 5e-5])
xlabel('omega/omegan')
ylabel('abs(H1)')
title('Techniques of Fixed Points')
hold on
%
% Theory of the TPF
% Optimum parameters considering primary system without damping
alphao=1/(1+mu);
k2=m2*(alphao*sqrt(k1/m1))^2;
Xi2o=1/alphao*sqrt(3*mu/(8*(1+mu)^3));
c2=Xi2o*2*m2*sqrt(k2/m2);

 for iomeg=1:length(omega)
     H11(iomeg)=(-omega(iomeg)^2*m2+k2+i*omega(iomeg)*c2)/((-omega(iomeg)^2*m2+k2)*(-omega(iomeg)^2*m1+k1)-omega(iomeg)^2*m2*k2+i*omega(iomeg)*c2*(-omega(iomeg)^2*m1+k1-omega(iomeg)^2*m2));
 end


plot(beta,abs(H11),'r-')


% Response of the compound system considering c2=0
c2=0;

 for iomeg=1:length(omega)
     H11(iomeg)=(-omega(iomeg)^2*m2+k2+i*omega(iomeg)*c2)/((-omega(iomeg)^2*m2+k2)*(-omega(iomeg)^2*m1+k1)-omega(iomeg)^2*m2*k2+i*omega(iomeg)*c2*(-omega(iomeg)^2*m1+k1-omega(iomeg)^2*m2));
 end


plot(beta,abs(H11),'b-')


% % Response of the compound system considering c2=infinito
c2=1000000000000;

 for iomeg=1:length(omega)
     H11(iomeg)=(-omega(iomeg)^2*m2+k2+i*omega(iomeg)*c2)/((-omega(iomeg)^2*m2+k2)*(-omega(iomeg)^2*m1+k1)-omega(iomeg)^2*m2*k2+i*omega(iomeg)*c2*(-omega(iomeg)^2*m1+k1-omega(iomeg)^2*m2));
 end


plot(beta,abs(H11),'g-')
legend('Without absorber','FPT','C2=0','C2=infinit')


