Hello, I have this code and for some reason it is giving me the error "Array indices must be positive integers or logical values." Then it mentions line 7 of the function as the point of error. Please help!
Here is the script:
clear all; clf
xspan = [0 100];
y0 = 0;
v0 = .001;
[x,z] = ode45('beamfunc', xspan, [y0 v0]);
y = z(:,1);
and here is the function 'beam func'
function dz = beamfunc(x,z)
L = 100; w = 100; E = 10^7; T = 500; I = 500;
v = z(2);
y = z(1);
vprime=(((1+v^2)^(3/2))*(T*y/E*I + w*x(x-L)/2*E*I));
dz = [yprime ; vprime];