Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Heaviside function in matlab

  1. Sep 5, 2011 #1
    Dear Fellows
    I need to define a function "f" in matlab as
    f is a heaviside unit step function

    I did it as

    f = heaviside[abs(-4)]

    but it is not working as I required.
     
  2. jcsd
  3. Sep 5, 2011 #2

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    The "heaviside" function is part of the symbolic maths toolbox and as such, requires a symbolic argument. Therefore, you need to modify your expression thus:
    Code (Text):
    heaviside(sym(abs(-4))
     
  4. Sep 5, 2011 #3

    Pythagorean

    User Avatar
    Gold Member

    If it's required you write it yourself, you're going to have to give us your code if you want troubleshooting help.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook