Not enough input arguments - ODE45

2 views (last 30 days)
Tom Atwell
Tom Atwell on 17 Feb 2019
Commented: Tom Atwell on 18 Feb 2019
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 Comments
Walter Roberson
Walter Roberson on 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 on 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.

Sign in to comment.

Answers (0)

Categories

Find more on Physics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!