function [v,vterm] = Student(m,d,T) % A funuction to deterined a vertically falling cannonball, while being
% effected by drag
% Various Constant
cd = 0.47; % drag coefficient for a sphere
rho = 1.2; % density of air
g = 9.81; % gravitational constant
dt = 0.1; % Time step
v = 0; % Vertically falling cannonball, released from rest
for t = 0:dt:T a = ((cd*rho*(pi*d^2))/2*m)-g ; v = v(t-1) + a(t)*dt ; hold on; plot (t,v,'.'); end Fnet = cd*0.5*rho*(v(t)^2)*(pi*d^2); if Fnet == 0 vterm = sqrt(2*m*g/rho*(pi*d^2)*cd); end
The code I used to call this function is as followed
[v,vterm] = Student(5,2,20)
and the error message that was returned to me was:
Undefined function 'Student' for input arguments of type 'double'.
%
Best Answer