MATLAB: Told I dont have enough input arguments. I dont understand where i went wring

input arguments

close all; clear all; clc;
timespan = [0 2];
y0 = [0.048 0 10; 0.048 0 20; 0.048 0 30; 0.48 0 40; 0.48 0 50; 0.48 0 60]; %array displacement, structural velocity, airflow velocity
figure (1);
axis ([-1 1 -1 1]);
grid on;
hold on;
box on;
xlabel('Air Flow Velocity (m/s)');
ylabel('Structural Displacement Amplitude (m)');
for i=1:length(y0)
[t,y,v] = ode15s( @equationb ,timespan ,y0);%equation, timestep, initial condition
plot(y(:,1), y(:,2)) %all the first column, all the second column
end
figure (2);
hold on;
function yp = equationb(t, y, v)
A=2.69; B=168; C=6270; D=59900; %coefficients
E= 15000000000;
h = 0.048;
I = (1/12)*h^4;
l=4;
rho=1600;
m = 0.177;
c = 0.77;
k = (48*E*I)/l^3;
R = (0.5*rho*h);
yp (1) = y(2);
yp (2,1) = (R/m)*(A*v*y(2).^2 - (B*y(2).^4)/v + (C*y(2).^6)/v^3 - (D*y(2).^8)/v^5) - (c/m)*y(2) - (k/m)*y(1);
end

Best Answer

The problem is ‘equationb’ and the way you call it in your ode45 call.
function yp = equationb(t, y, v)
call it as:
[t,y] = ode15s( @(t,y) equationb(t, y, v) ,timespan ,y0);%equation, timestep, initial condition
I didn’t run your code (because I’m not certain what you’re doing) but that should at least eliminate the ‘not enough input arguments’ error.
Related Question