
What is heaviside and how replace ?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
COTTINEAU Christophe
am 8 Okt. 2015
Beantwortet: COTTINEAU Christophe
am 8 Okt. 2015
Hello,
I try to used a example plot.m find on Internet :
%%COURBE AVEC UN CRENEAU
figure
t=-20:20;
y = heaviside(t)
plot(t,y)
axis([-10 10 -2 2])
but the my Matlab R2015a say :
Undefined function or variable 'heaviside'. Error in Plot (line 130) y = heaviside(t)
and help don't find also
Please help Best regards Christophe
0 Kommentare
Akzeptierte Antwort
Stephen23
am 8 Okt. 2015
Bearbeitet: Stephen23
am 8 Okt. 2015
When you do a search of the documentation like this:
the green text underneath each search result tells you what toolbox or product that result applies to. The results of searching for "Heaviside" produces only results for the "Symbolic Math Toolbox", ergo heaviside is not a standard MATLAB function.
If you want a numeric version to use in MATLAB then try this anonymous function:
myHeaviside = @(V)(1+sign(V))/2;
which uses the H(0)==0.5 convention. Here it is used with your code:
>> myHeaviside = @(V)(1+sign(V))/2;
>> t = -20:20;
>> y = myHeaviside(t);
>> plot(t,y)
>> ylim([-0.1,1.1])
which produces this figure:

0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!