
What is heaviside and how replace ?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
COTTINEAU Christophe
el 8 de Oct. de 2015
Respondida: COTTINEAU Christophe
el 8 de Oct. de 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 comentarios
Respuesta aceptada
Stephen23
el 8 de Oct. de 2015
Editada: Stephen23
el 8 de Oct. de 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 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Multirate Signal Processing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!