Borrar filtros
Borrar filtros

How Define Delta Function

91 visualizaciones (últimos 30 días)
Kutlu Yigitturk
Kutlu Yigitturk el 24 de Mzo. de 2021
Comentada: Kutlu Yigitturk el 24 de Mzo. de 2021
I have a problem about calculating with Delta Function. I am trying write matlab code for these function.
I wrote the following code for this function.
n = -5:1:7;
x = delta(n+1) - delta(n) + unit(n+1) - unit(n-2);
stem(n,x,'fill');
axis([-6 8 -1.5 1.5])
xlabel('n')
ylabel('x[n]')
grid
But I am getting the following error.
I don't now how can ı write the delta function in this way ,
function y = unit(x);
y = zeros(size(x));
y(x>0) = 1;
end
Can you help me write the delta function as the 'unit' function you see above? Thank you for your helping.

Respuesta aceptada

Star Strider
Star Strider el 24 de Mzo. de 2021
If you have the Symbolic Math Toolbox, use the dirac function. It can be used with non-symbolic arguments as well.
  4 comentarios
Walter Roberson
Walter Roberson el 24 de Mzo. de 2021
That is not a true Dirac δ function.
delta = @(x) x==0;
unit = @(x) x>=0;
n = -5:1:7;
x = delta(n+1) - delta(n) + unit(n+1) - unit(n-2);
stem(n,x,'fill');
axis([-6 8 -1.5 2])
xlabel('n')
ylabel('x[n]')
grid
Kutlu Yigitturk
Kutlu Yigitturk el 24 de Mzo. de 2021
Thank you for your help Mr. Roberson. I got the result I wanted.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by