I've gone through and vectorized your code (taken out the for loops); this will help it to run faster. The plot command now joins the points with lines.
m=50;
c=2*10^3;
k=2*10^7;
Wn=sqrt(k/m);
Kc=3.5*10^8;
b=0.005;
v=1.784;
zeta=c/sqrt(4*k*m);
n=0:8;
w= input('Enter the value of chatter frequency at natural frequency in rad/sec:');
w_vec = w:1000;
R = (Wn^2 - w_vec.^2).^2 + (2*zeta*Wn)^2 * w_vec.^2;
G = (Wn^2 - w_vec.^2).^2./R;
H = -(2*zeta*Wn*w_vec)./R;
b_lim = -1000./(2*Kc*G);
Psi = -atan(mod(H,G))*180/pi;
Psi(G<0&H<0) = -180-Psi(G<0&H<0);
Psi(G<0&H>0) = -180+Psi(G<0&H>0);
Psi(G>0&H>0) = -360-Psi(G>0&H>0);
Theta = (3*pi+2*Psi)*pi/180;
n = (1:9)';
T = (2*n*ones(1,51)*pi+ones(9,1)*Theta)./(ones(9,1)*w_vec);
N = 60./T;
plot(N,b_lim,'.-');
xlabel ('N in rpm');
ylabel ('b-lim in mm');
title ('Plot of b-lim vs N');
grid on;
Best Answer