Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. clc
  2. clear all
  3. close all
  4.  
  5. E=5
  6. T=10
  7. k1= 8/5 %E/T
  8. k2=-3/2 %-E/(2*T)
  9. pas=0.05
  10. f=[]
  11. temps=[];
  12. fin= 20 %5*T
  13. for t=-20 : pas : fin
  14. temps=[temps t]
  15. if ((t>=-16)&&(t<-8))
  16. f = [f 2]
  17. else if (t>=-8) && (t<-3)
  18. f = [f -3+k1*(t+8)]
  19. else if ((t>=-3) && (t<0))
  20. f = [f -3+k1*(t+8)-k1*(t+3)]
  21. else if ((t>=0) && (t<4))
  22. f = [f -3+k1*(t+8)-k1*(t+3) + k2*t]
  23. else if ((t>=4) && (t<16))
  24. f = [f -3+k1*(t+8)-k1*(t+3) + k2*t- k2 *(t-4)]
  25. else
  26. f=[f 0]
  27. end
  28. end
  29. end
  30. end
  31. end
  32. end
  33.  
  34. figure(20)
  35. hold on
  36. plot(temps,f)
  37. set(gcf,'color',[1,1,1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement