What is the problem with the heaviside function?
Show older comments
fun =
@(p,x)p(1)*heaviside(x-p(2))
Undefined function 'heaviside' for input arguments of type 'double'.
Accepted Answer
More Answers (1)
The error means that Matlab cannot find the heaviside function. Try
which heaviside
to locate the function. The heaviside function is part of the Symbolic Math Toolbox. If you do not have this TB, you can write your own heaviside function
function y = heaviside(x)
y = (x > 0) + 0.5*(x == 0);
1 Comment
Dief Gerard
on 10 Feb 2022
@Thorsten Thanks for your answer. It helped me debug my code.
Categories
Find more on Startup and Shutdown 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!