### MATLAB >> Dirac delta function

excuse me anybody knows how can I generate the Dirac Delta function
in Simulink? somebody told me that I should use the step function and
a derivate, the problem it's that I have to made it with simulink,
but I don't know how, I hope you could help me.

### MATLAB >> dirac delta function

I have looked into dirac function. However, from the documentation, it
looks like the parameters have to be a syms type. I'm trying to
substitute an expression into the parameter such that I can obtain a
plot of perhaps a few delta functions. What would be the easiest, most
effective way to accomplish this (an example would be fantastic)?

### MATLAB >> dirac delta function

Correct. That's because Dirac's Delta is a symbolic
function and has no numerical representation.

Have you ever seen an exact plot of a Dirac Delta?
If 'no', can you think of any reason why?

Rune

### MATLAB >> dirac delta function

In reality there is no plot for Dirac delta as it is a distribution
and not a function as such. The plots which you try to plot in matlab
are all Kronecker delta and not Dirac deltas.

bhupala

### MATLAB >> dirac delta function

Thank you all for your replies. I guess I could try to just plot
kronecker delta functions and then modify them by hand later. I am
having trouble finding how to plot kronecker delta functions on the
Matlab documents. Does it only involve making the value equal to the
amplitude when the parameter in the delta function equal to zero?

```Hi,

a question on how to express dirac delta function in matlab
in fact , i have to calculate k(n+1) = k(n) +c*(A*b), where k is a vector and A is a matrix. but the problem is that k(0) = the delta function, how can i start this calculation ?

thanks a lot
best regards

Tao
```

```I am trying to solve a pde using the pdepe solver of Matlab. The
initial condition of my problem is a Dirac delta function (with x is
0 if different from 0.03). I could specify the initial condition as
e.g.

function u0 = pdex1ic(x)
u0 = 0;
if x >=0.03 & x<0.0301
u0 = 1.e100;
end

but this produces highly inaccurate results and I prefer to use
dirac(x-0.03). However, if I write
function u0 = pdex1ic(x)
u0 = dirac(x-0.03)
I get an error message. Does anyone know how to solve this?
```

```Hello:

I'm trying to use one of the ode solvers (say, ode45) to solve a
system of ODEs, some of which involve Dirac deltas. Here's a
simplified example:

%------- begin code -------%
function dy = temp(t,y)

dy = mu*dirac(t - 3)*sin(t);
%-------- end code --------%

Now I realize that this ODE is easily solved by hand, but because the
differential equations are coupled, it's more or less impossible to
solve all of them. (In the above example you can assume that, say,
the parameter mu depends on variables from other differential
equations.) The problem is that Matlab's ode solvers don't seem to
work with the 'dirac' function--though they like the 'heaviside'
function just fine. Is there an ode solver or a method that works
for the above example?

Thanks,

HB
```

```Hi all,

how can i generate a vector of diracs spaced with a step S, when i
use the function dirac (which doesn't exist in all the matlab
versions) i get nothing ..
thanks
```