Borrar filtros
Borrar filtros

Inline function is not working properly

5 visualizaciones (últimos 30 días)
Rafael Perales
Rafael Perales el 25 de Oct. de 2019
Respondida: Guillaume el 25 de Oct. de 2019
So I am trying to make a stem graph and the text book uses inline to create a function for discrete time function but I keep having errors using it. The function is i just want to know for either an alternative or why the inline function isnt working with my code. Snippet of code not working:
n = -10:10;
f = inline('e^(-n/5).*cos(pi*n/5).*(n>=0)','n');
stem(n,f(n),'k');

Respuesta aceptada

Guillaume
Guillaume el 25 de Oct. de 2019
is exp(x) in matlab. There is no need for inline:
f = @(n) exp(-n/5) .* cos(pi*n/5) .* (n>=0);
assuming is n>=0.

Más respuestas (0)

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by