Advertisement
Guest User

HW

a guest
Jun 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.91 KB | None | 0 0
  1. function [Fp] = Fp_f(t)
  2. if (t >= 0 && t <= 100) then
  3. Fp = 100*t;
  4. elseif (t >= 100 && t <= 600) then
  5. Fp = 10000;
  6. elseif (t >= 600 && t <= 1100) then
  7. Fp = 10000 + 5000*sin(((t-600)*%pi)/100);
  8. elseif (t >= 1100 && t <= 1200) then
  9. Fp = (t-1200)^2;
  10. elseif (t >= 1200 && t <= 1800) then
  11. Fp = 0;
  12. end;
  13. endfunction;
  14. t=0:1:1800;
  15. Fp = feval(t,Fp_f);
  16. plot(t,Fp);
  17. xtitle("Propulsion Force as a function of time", "Time (s)", "Propulsion Force (N)");
  18. xs2gif(0,"Propulsion Force.gif");
  19. clf
  20. function [Ff] = Ff_f(v)
  21. if (v >= 0 && v <= 1) then
  22. Ff = K1*sqrt(v);
  23. elseif (v > 1) then
  24. Ff = K2*v^2;
  25. elseif (v < 0) then
  26. Ff = 0;
  27. //Alle voorwaarden voor Ff ifv de snelheid
  28. end;
  29. endfunction;
  30. v=0:1:20; K1 = 100; K2 = 70;
  31. Ff = feval(v,Ff_f);
  32. plot(v,Ff);
  33. xtitle("Friction Force as a function of the ship speed", "Ship Speed (m/s)", "Friction Force (N)");
  34. xs2gif(0,"Friction Force.gif");
  35. clf
  36. fsolve(5000,Ff_f)
  37. fsolve(12000,Ff_f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement