

amplitudes and phase frequency response of two-mass oscillator
Hello all,
I wrote down the differential equations for a two-mass oscillator, transformed it to state form and solved the model with scilab, which worked perfectly (see picture in the appendix). Now, I want to generate a plot for the amplitudes and phase frequency response of this system, but I don't know how to to this in scilab. Can anyone help me out here?
The scilab-code is as follows:
m1 = 0.01; m2 = 0.005; C1 = 200; C2 = 100; D1 = 0.0; D2 = 0.0; Fdach = 0.1; omega = sqrt(C1/m1); function f=rechteSeite(t, y) A = [[0,0,1,0];[0,0,0,1];[-(C1+C2)/m1,C2/m1,-(D1+D2)/m1,D2/m1];C2/m2,-C2/m2,D2/m2,-D2/m2]; q = [0;0;1/m1;0]*(Fdach)*cos(omega*t); f = A*y+q; endfunction t = linspace(0,20,10000); y0 = [0,0,0,0]'; t0 = 0; y = ode(y0,t0,t,rechteSeite); subplot(311) plot(t,y(1,:));//,t,y(2,:));//,t,y(3,:),t,y(4,:)); hl=legend(['x1';'x2';'x1p';'x2p']); subplot(312) plot(t,y(2,:));//,t,y(2,:));//,t,y(3,:),t,y(4,:)); hl=legend(['x2';'x2';'x1p';'x2p']);
See also the uploaded picture for further information.
Kind regards
vanKir

Scilab


the following code must be added to the script above: //Frequenzgang
M = [m1,0;0,m2];
K = [C1+C2,-C2;-C2,C2];
D = [D1+D2,-D2;-D2,D2];
om=0;
ome=zeros(1000);
for i=1:1:1000
om=om+1;
alpha=(K-om^2*M+complex(0,1)*om*D)^-1;
alpha_calc(i)=abs(alpha(1,1));
ome(i)=i;
end
subplot(414)
plot(ome,alpha_calc)
M = [m1,0;0,m2];
K = [C1+C2,-C2;-C2,C2];
D = [D1+D2,-D2;-D2,D2];
om=0;
ome=zeros(1000);
for i=1:1:1000
om=om+1;
alpha=(K-om^2*M+complex(0,1)*om*D)^-1;
alpha_calc(i)=abs(alpha(1,1));
ome(i)=i;
end
subplot(414)
plot(ome,alpha_calc)
Login to add comment