create a delta function that is 1 at t equal to 0 in matlab

In Matlab, you can define the delta function as an array of zeros with a single non-zero element at the position corresponding to t = 0.

Here's how to create it:

main.m
delta = [1, zeros(1, 10)];
27 chars
2 lines

In this example, I've created a delta function with 11 elements, where the first element is 1 and the rest are zeros.

You can change the length of the array by modifying the second argument of the zeros function.

related categories

gistlibby LogSnag