Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. t = 0:0.2:25
  2. s1 = 0.1553567.*t.^6 - 2.0416.*t.^5 + 9.1837.*t.^4 - 14.829.*t.^3 - 1.3703.*t.^2 + 32.821.*t - 1.3155
  3. s2 = 0.003980879.*t.^5 - 0.2247.*t.^4 + 4.8682.*t.^3 - 50.442.*t.^2 + 254.67.*t - 430.66
  4. s3 = -0.073.*t.^2 + 6.1802.*t + 40.423
  5.  
  6.  
  7. idx1 = []
  8. idx2 = []
  9. idx3 = []
  10. for i = 1:length(t)
  11. if t(i) < 5
  12. idx1 = [idx1, 1];
  13. idx2 = [idx2, 0];
  14. idx3 = [idx3, 0];
  15. elseif t(i) < 15.4
  16. idx1 = [idx1, 0];
  17. idx2 = [idx2, 1];
  18. idx3 = [idx3, 0];
  19. else t(i) <= 25
  20. idx1 = [idx1, 0];
  21. idx2 = [idx2, 0];
  22. idx3 = [idx3, 1];
  23. end
  24. end
  25. hold on
  26. plot(t(idx1),s1(idx1))
  27. plot(t(idx2),s2(idx2))
  28. plot(t(idx3),s3(idx3))
  29. hold off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement