Not enough input arguments - ODE45

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 Kommentare

Steven Lord
Steven Lord am 17 Feb. 2019
Which line of the code you've posted is line 23?
Is all this code in one file or is the code you posted that defines your ODE function in one file and the code that calls the ODE solver using that ODE function in another? If it's all in one file, split it into two where the second one starts with the line that defines the timerange variable.
Walter Roberson
Walter Roberson am 17 Feb. 2019
I do not have any problem as long as I break the part from "timerange =" onward into a separate file. Well, the output is flat 0 for those input conditions, but not an error message.
Setting a non-zero second initial condition can lead to execution taking a long time.
Walter Roberson
Walter Roberson am 18 Feb. 2019
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 am 18 Feb. 2019
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Physics finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 17 Feb. 2019

Kommentiert:

am 18 Feb. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by