- #1
mohamed_ali
- 6
- 0
hi
i am trying to solve second order ODE in MATLAB but when i write my scribt and call into the command window using ode45 i get input argument "a" is undefined i have spent so much time trying to figure out what the problem is but unsuccessful.
the function is as follows
function da_dt=canti(t,a,flag,zeta,epsi,lampda,z,omega)
%this function solves the non-linear equation of motion for a cantilever
%beam with lumped mass
L=125.4; % Lenght of the beam, the units are in mm
r=125.4; % this is the radius of gyration of the beam (mm)
J=600.9; % polar moment of inertia, unit which are mm^4
d=93.68; %position of mass (mm)
E=0.20936e-6; % stiffness of the beam (N/mm^2)
w=11.11; % this is the width of the beam (mm)
m=14.70; % the mass (g)
g=9.81; % acceleration due to gravity (m/s^2)
%lampda=1; lampda=r/L
h=0.368; %the thickness of the beam (mm)
I=4.626e-2; %cross-sectional moment of inertia (mm^4)
rho=0.03177; % the density (g/mm^3)
k=1.609; %radius of curevature of the beam at s
H11=0.977127;
H12=0.977127;
H13=0.687553;
H21=0.977127;
H31=0.977127;
H32=0.168365;
H33=0.153578;
H34=0.270738;
H41=0.325800;
H42=0.578800;
H43=-0.319906;
H51=0.217654;
H52=0.732989;
H53=0.472729;
H61=0.217654;
H62=0.231875;
H63=0.732989;
H64=0.393123;
H65=0.236364;
if nargin<1, zeta=1.469e-3; %this is the damping ratio
end
if nargin<2, epsi=1; %this value is intoduced to show the smallness of damping, nonlinear terms,and excitation
end
if nargin<3, lampda=1;
end
if nargin<4, z=2;% this is the amplitude of the excitation
end
if nargin<5, omega=5; %frequency of excitation
end
mu=m/rho*L;
Q=(H11+mu*H12+J(1)*H13*lampda*lampda);
c=abs(2*zeta*sqrt(E*m));
zeta1=(c*H21)/(2*epsi*rho*Q);
alpha1=((E*I*lampda*lampda)/(epsi*rho*Q*L^4))*((k^4)*(H41+mu*H42)+H43);
J(1)=J/rho*L*r^2;
theta=abs(sqrt(((E*I*k^4)*(H31+mu*H32)/(rho*L^4)-(g/L)*(H33+mu*H34))/Q));
zeta=zeta1/theta;
alpha=alpha1/theta;
phi=omega/theta;
lampda=r/L;
f=(omega*omega*(z))*(H33+mu*H34)/(epsi*(theta^2)*(Q));
K1=((lampda*lampda)*(H51+mu*H52+H53*J(1)*lampda*lampda)/epsi*Q);
K2=((lampda*lampda)*(H61-H62+mu*H63-mu*H64+J(1)*H65*lampda*lampda)/epsi*Q);
da_dt=zeros(2,1);
da_dt(1)=a(2);
da_dt(2)=-((2*zeta*epsi*a(2)+(1 - epsi*f*cos(phi*t))*a(1)+epsi*alpha*(a(1)*a(1)*a(1))+epsi*K1*a(1)*a(2)*a(2))/(1 + epsi*K2*a(1)*a(1)));
end
please can anyone help
thanks
i am trying to solve second order ODE in MATLAB but when i write my scribt and call into the command window using ode45 i get input argument "a" is undefined i have spent so much time trying to figure out what the problem is but unsuccessful.
the function is as follows
function da_dt=canti(t,a,flag,zeta,epsi,lampda,z,omega)
%this function solves the non-linear equation of motion for a cantilever
%beam with lumped mass
L=125.4; % Lenght of the beam, the units are in mm
r=125.4; % this is the radius of gyration of the beam (mm)
J=600.9; % polar moment of inertia, unit which are mm^4
d=93.68; %position of mass (mm)
E=0.20936e-6; % stiffness of the beam (N/mm^2)
w=11.11; % this is the width of the beam (mm)
m=14.70; % the mass (g)
g=9.81; % acceleration due to gravity (m/s^2)
%lampda=1; lampda=r/L
h=0.368; %the thickness of the beam (mm)
I=4.626e-2; %cross-sectional moment of inertia (mm^4)
rho=0.03177; % the density (g/mm^3)
k=1.609; %radius of curevature of the beam at s
H11=0.977127;
H12=0.977127;
H13=0.687553;
H21=0.977127;
H31=0.977127;
H32=0.168365;
H33=0.153578;
H34=0.270738;
H41=0.325800;
H42=0.578800;
H43=-0.319906;
H51=0.217654;
H52=0.732989;
H53=0.472729;
H61=0.217654;
H62=0.231875;
H63=0.732989;
H64=0.393123;
H65=0.236364;
if nargin<1, zeta=1.469e-3; %this is the damping ratio
end
if nargin<2, epsi=1; %this value is intoduced to show the smallness of damping, nonlinear terms,and excitation
end
if nargin<3, lampda=1;
end
if nargin<4, z=2;% this is the amplitude of the excitation
end
if nargin<5, omega=5; %frequency of excitation
end
mu=m/rho*L;
Q=(H11+mu*H12+J(1)*H13*lampda*lampda);
c=abs(2*zeta*sqrt(E*m));
zeta1=(c*H21)/(2*epsi*rho*Q);
alpha1=((E*I*lampda*lampda)/(epsi*rho*Q*L^4))*((k^4)*(H41+mu*H42)+H43);
J(1)=J/rho*L*r^2;
theta=abs(sqrt(((E*I*k^4)*(H31+mu*H32)/(rho*L^4)-(g/L)*(H33+mu*H34))/Q));
zeta=zeta1/theta;
alpha=alpha1/theta;
phi=omega/theta;
lampda=r/L;
f=(omega*omega*(z))*(H33+mu*H34)/(epsi*(theta^2)*(Q));
K1=((lampda*lampda)*(H51+mu*H52+H53*J(1)*lampda*lampda)/epsi*Q);
K2=((lampda*lampda)*(H61-H62+mu*H63-mu*H64+J(1)*H65*lampda*lampda)/epsi*Q);
da_dt=zeros(2,1);
da_dt(1)=a(2);
da_dt(2)=-((2*zeta*epsi*a(2)+(1 - epsi*f*cos(phi*t))*a(1)+epsi*alpha*(a(1)*a(1)*a(1))+epsi*K1*a(1)*a(2)*a(2))/(1 + epsi*K2*a(1)*a(1)));
end
please can anyone help
thanks