I am trying to wrtie Shaft_speed as a function of time , so the shaft speed should increase to from 1 to 4000 as time goes on.
I also need the initial condition values X,Y and Z of the last speed to be the new intial condition of the new shaft speed. so far i have:
clc,clear,close all
J=3.37e-5;
K1=0.7243;
K3=1409.7;
f=0.005;
Zeta=0.05;
Cmech=2*Zeta*(sqrt(K1/J))*J;
Rint=82;
Rload=82;
ECF=sqrt(1.9e-6/Rint);
L=160e-3;
X = 0;
Y = 0;
Z = 0;
Shaft_speed=0:1000;
Rad_speed=Shaft_speed.*((2*pi)/60);
w=2.*Rad_speed;
w_Hz=w./2*pi;
nt=1./w_Hz;
Time=0:nt/100:100*nt;
Iter=10;
for r=1:Iter
[t,q]=ode45(@duf,Time,[X Y Z]);
X=q(end,1);
Y=q(end,2);
Z=q(end,3);
Max_values(r) = max(q(:,1))
plot(t,q(:,1),'k')
xlabel('TIme,s')
ylabel('Relative Displacement, Rad')
grid
end
max=max(Max_values)
function qdot=duf(t,q)
J=3.37e-5;
K1=0.7243;
K3=1409.7;
f=0.005;
Zeta=0.05;
Cmech=2*Zeta*(sqrt(K1/J))*J;
Rint=82;
Rload=82;
ECF=sqrt(1.9e-6/Rint);
L=160e-3;
Shaft_speed=0:1000;
Rad_speed=Shaft_speed.*((2*pi)/60);
w=2.*Rad_speed;
w_Hz=w./2*pi;
qdot(1)=q(2);
qdot(2)=f.*w.^2.*cos(w.*t)-(Cmech/J).*q(2)-(K1/J).*q(1)-(K3/J).*q(1).^3- ECF.*q(3);
qdot(3)=(-ECF.*q(2)-(Rint+Rload).*q(3))./L;
qdot = [qdot(1);qdot(2);qdot(3)];
end
but i geet keep getting '-Error using odearguments (line 21)
When the first argument to ode45 is a function handle, the tspan argument must have at least two elements.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in mainduffing (line 33)
[t,q]=ode45(@duf,Time,[X Y Z]);'
Thanks in advance
0 Comments
Sign in to comment.