Ex-3 (Program)
Ex-3 (Program)
clc;
clear all;
clf;
F = input('Enter the value of input force:'); //F=500 N
M = input('Enter the value of mass:'); //M=1000 kg
B = input('Enter the value of friction coefficient:'); //B=50 Ns/m
t=0:0.0001:350;
num = poly([F], 's', 'c');
den = poly([B M], 's', 'c');
sys1_mech = syslin('c', num/den)
disp(sys1_mech)
y=csim('step',t,sys1_mech);
plot(t,y)
xlabel("t", "fontsize", 2, "color", "blue");
ylabel("y");
title('First order mechanical system','color','red');
s=poly(0,'s');
t=0:0.01:80;
w = input('Enter the value of natural frequency of oscillation:'); %w=1
for i=1:5 //z=0.1, 0.4, 0.7, 1.0, 2.0
z(i)=input('Enter the value of damping coefficient:');
sys=(w*w)/(s^2 + (2*w*z(i)*s)+ w*w)
plot2d(t,csim ('step', t, sys))
end
xlabel("t", "fontsize", 2, "color", "blue");
ylabel("y");
title('effect of damping ratio','color','red');