Not enough input arguments - ODE45

조회 수: 3 (최근 30일)
Tom Atwell
Tom Atwell 2019년 2월 17일
댓글: Tom Atwell 2019년 2월 18일
Hi,
I am struggling to solve the attached non-linear differential equation. The Hertz contact law is what I'm trying to solve - steel ball impacting into a flat plate. Not enough input arguments comes up for line 23.
My current code is as follows:
%Trial
%y"+(1/8)*((I*D)^(1/2))*(3/2)*(K)*(y^1/2)*y')+(K/M)y;
function dydt=f(t,y)
%Constants
Es=210000000; %Youngs Modulus of Glass/Steel Plate (Pa)
rs=10; %radius of impactor (mm)
M=0.0329; %impactor mass (kg)
a=0.2; %length of plate (m)
b=0.2; %width of plate (m)
h=0.008; %plate thickness (m)
vs=0.3; %Poissons ratio of steel/glass
ps=7800; %density of steel/glass plate (kg/m3)
volume=a*b*h; %volume of plate (m3)
I= ps*volume; %total mass of steel/glass plate (kg)
z1=(1-vs^2)/Es*pi;
z2=(1-vs^2)/Es*pi;
K=(4/3*pi)*(rs^(1/2))*(1/(z1+z2)); %contact stiffness
D=(Es*h^3)/(12*(1-vs^2));
%Define inputs
dydt=zeros(2,1);
dydt(1)=y(2);
dydt(2)=(-1/8)*((I*D)^(1/2))*(3/2)*(K)*(y(1)^1/2)*y(2)-(K/M)*y(1);
timerange = [0 100];
initialvalues = [0 0];
[t,y] = ode45(@f,timerange,initialvalues);
plot(t,y(:,1))
ylabel('y')
xlabel('x')
I am unsure where i've gone wrong, be that in the code or in the approach.
Any help would be greatly appreciated!
  댓글 수: 4
Walter Roberson
Walter Roberson 2019년 2월 18일
I wonder if you tried to execute the f.m file directly, instead of having timerange on down in a separate script and running that script ?
Tom Atwell
Tom Atwell 2019년 2월 18일
Thank you! No more error message. I see what you mean in regards to a non-zero second initial condition. Just need to find it now.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Physics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by