Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dt=0.005;
- g=9.80665;
- C=0.1;
- m=10;
- tcalkowity=10000;
- n=1;
- nmax=0;
- nkoncowe=0;
- tmax=0;
- tkoncowe=0;
- ymax=0;
- t=zeros(tcalkowity,1);
- V=zeros(tcalkowity,1);
- y=zeros(tcalkowity,1);
- V(1)=500;
- y(1)=0;
- while y(n,1)>=0
- t(n+1)=t(n)+dt;
- V(n+1)=V(n)+dt*(-g-(C*abs(V(n))*V(n))/m);
- y(n+1)=y(n)+dt*V(n);
- n=n+1;
- nkoncowe=n-1;
- end
- for n=1:nkoncowe
- if y(n,1)<=y(n+1,1)
- ymax=y(n+1,1);
- nmax=n+1;
- end
- end
- tmax = nmax*dt;
- tkoncowe = nkoncowe*dt;
- plot(t,y)
- tmax
- tkoncowe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement