Prev: ode45 help needed, equations of motion
Next: mex error on 64-bit Mac OS 10.6 (running 32 bit Matlab)
From: cartonn on 31 Jan 2010 18:50 I just needed to write these functions and thought they could be useful for others as well. And what makes them kind of cool is that they are all "one-liners" Here they are: function [result] = unit_impulse(t) result = -abs(sign(t))+1; end function [result] = unit_step(t) result = ceil(ceil(sign(t)+.1)*.5); end function [result] = unit_ramp(t) result = unit_step(t).*t-unit_step(t-1).*(t-1); end |