Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.35 KB | None | 0 0
  1. t = 0.01:0.01:10;
  2. x = zeros(length(t));
  3.    
  4. for n = 1: length(t)
  5.     if(t(n) < 6)
  6.         if(t(n) < 4)
  7.             if(t(n) < 2)
  8.                 x(n) = t(n)^2;
  9.             else
  10.                 x(n) = 4;
  11.             end
  12.         else
  13.             x(n) = -2 * t(n) + 12;
  14.         end
  15.     else
  16.         x(n) = 1/2 * t(n) - 3;
  17.     end
  18. end
  19.  
  20. plot(t,x);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement