- #1
bcjochim07
- 374
- 0
Homework Statement
A 75.0 g ball with radius 10cm is dropped. I am supposed to write a program that plots y as a function of time, including acceleration due to gravity and drag force of D=0.25*area*velocity.
Homework Equations
The Attempt at a Solution
Here's what I tried:
>> n=21;
>> t=zeros(1,n);
>> v=zeros(1,n);
>> y=zeros(1,n);
>> h=0.5;
>> g=-9.80;
>> m=0.075;
>> A=pi*0.10*0.10;
>> for i = 2:n
t(i)=(i-1)*h;
fdrag=0.25*A*v*v;
adrag=fdrag/mass;
a=adrag+g;
v(i)=v(i-1)+a*h;
y(i)=y(i-1)+v(i-1)*h+0.5*a*h*h;
end;
? Error using ==> mtimes
Inner matrix dimensions must agree.
>>
t is time, h is time increment, m is mass, a is total acceleration, A is area
I don't understand the error that I am making. Could someone please help me?