You are on page 1of 7

MATLAB code for Circle Fit Method

problem taken is from Assignment 3

clear all
clc
format short
m1=1; m2=2;m3=1;
k1=10^6 ; k2=10^7 ; k3=10^7 ; k4=10^6 ;
mass_matrix =[m1 0 0 ; 0 m2 0 ; 0 0 m3];
M=mass_matrix;
stiffness_matrix =[k1+k2 -1*k2 0 ; -1*k2 k2+k3 -1*k3 ; 0 -1*k3 k3+k4];
K=stiffness_matrix;
[eigenvector eigenvalues]=eig(stiffness_matrix*(1+1j*0.02) ,mass_matrix);
V=eigenvector; D=eigenvalues;
natural_frequencies=sqrt(eigenvalues);
w=linspace(0,6000,10000);b=zeros(1,3);b1=zeros(1,3);
for i= 1:10000
a=0;b=0;
for r=1:3
alpha_13(i)=(V(1,r)*V(3,r)/(D(r,r)-w(i)^2))+a;
a=alpha_13(i);

end

end

plot((w),log(abs(alpha_13)))
title(' Frequency response function')
xlabel(' frequencies')
ylabel(' amplitudes')
[peak_frequency]=ginput(1)
frequency_range=[real(peak_frequency)-9:2:real(peak_frequency)+9]
r=input('enter mode number')
real_frf=zeros(1,10);imag_frf=zeros(1,10);
for ii= 1:10
frequency=frequency_range(ii);
FRF_13(ii)=(V(1,r)*V(3,r)/(D(r,r)-frequency^2));
real_frf(ii)=real(FRF_13(ii))
imag_frf(ii)=imag(FRF_13(ii))
end
plot(real_frf,imag_frf,'.')
xlabel('real part of frf')
ylabel('imaginary part of frf')
title('pick up 10 points from this graph')
[x y]=ginput(10)
hold on
% finding the centre and radii of circle(method taken from internet)
a1=[x y ones(size(x))]\[-(x.^2+y.^2)];
xc = -.5*a1(1)

yc = -.5*a1(2)
R = sqrt((a1(1)^2+a1(2)^2)/4-a1(3))
plot(xc,yc,'*')
hold on
theta=linspace(0,2*pi,500);
xp=xc+R*cos(theta);
yp=yc+R*sin(theta);
plot(xp,yp,'r')
axis equal
xlabel('real part')
ylabel('imaginary part')
title('nyquist plot')
% identification of natural frequency
sweep_rate=zeros(1,9);%(9 comes because 10 points are choosen for circle)
for i=1:9
vec1=sqrt((xc-x(i))^2+(yc-y(i))^2);
vec2=sqrt((xc-x(i+1))^2+(yc-y(i+1))^2);
sweep_rate(i)=(((xc-x(i))*(xc-x(i+1)))+((yc-y(i))*(yc-y(i+1))))/(vec1*vec2);
end
[maximum_sweep_rate location_of_maximum]=max(sweep_rate)
% To find the Natural_frequency
point=location_of_maximum
natural_frequency=(frequency_range(point)+frequency_range(point+1))/2

% To find the loss factor

loss_factor=zeros(1,9);%(9 comes because 10 points are choosen for circle)


for i=1:9
vec0=sqrt((xc-x(point))^2+(yc-y(point))^2);
vec1=sqrt((xc-x(i))^2+(yc-y(i))^2);
vec2=sqrt((xc-x(i+1))^2+(yc-y(i+1))^2);
angle1=(((xc-x(i))*(xc-x(point)))+((yc-y(i))*(yc-y(point))))/(vec0*vec1);
angle2=(((xc-x(i+1))*(xc-x(point)))+((yc-y(i++1))*(yc-y(point))))/(vec0*vec2);
w1=frequency_range(i);w2=frequency_range(i+1);wr=natural_frequency;
loss_factor(i)=(w1^2-w2^2)/(wr^2*(tan((angle2/2))-tan((angle1/2))));
end
temp=0;
for i=1:9
final_loss_factor=loss_factor(i)+temp;
temp=final_loss_factor;
end
modal_loss_factor=(final_loss_factor/9)

% To find the amplitude of modal constant


modal_constant_amplitude=2*R*modal_loss_factor*wr^2

Results:

Frf_11

fitted circle alpha11(mode2)

fitted circle alpha11(mode1)

fitted circle alpha11(mode3)

Alpha_12:

frf

Alpha_13:

You might also like