Hello everyone,
I have a problem writing my function on matlab and it simply shows that when I start from v(1.1)is not possible and it should be a positive integer.
it is a very simple function including a loop but it is required. this function is supposed to calculate the velocity and time for each height.
this is what I have written so far.
function y=freefall(v,t) g=9.81;%Gravity in m^2/s
h=input('Please Enter the hieght\n')for k=1:h v(k)=sqrt(2*g*k);end for k=1:h t(k)=sqrt(2*k/g);end plot(t,v)xlabel('Time (s)')ylabel('Velocity(m/s)')title('Free fall: velocity vs time')
Best Answer