I have a simple question how do I save the outputs of my script to a vector
    5 views (last 30 days)
  
       Show older comments
    
for t = -5:.2:50
   if (t > 0) && (t <= 10)
  vel = 11*t^2 - 5*t;
  elseif (t >= 10) && (t <= 20)
      vel = 1100 - 5*t
      elseif (t >= 20) && (t <= 30)
          vel = 50*t + 2*((t-20)^2)
          elseif t > 30
              vel = 1520*exp(-0.2*(t-30))
              else
                  vel = 0
   end
end
0 Comments
Accepted Answer
  Birdman
      
      
 on 25 Jan 2018
        t = -5:.2:50;
for i=1:numel(t)
   if (t(i) > 0) && (t(i) <= 10)
  vel(i) = 11*t(i)^2 - 5*t(i);
  elseif (t(i) >= 10) && (t(i) <= 20)
      vel(i) = 1100 - 5*t(i)
      elseif (t >= 20) && (t <= 30)
          vel(i) = 50*t(i) + 2*((t(i)-20)^2)
          elseif t(i) > 30
              vel(i) = 1520*exp(-0.2*(t(i)-30))
              else
                  vel(i) = 0
   end
end
0 Comments
More Answers (0)
See Also
Categories
				Find more on Computer Vision with Simulink in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
