Mathematica Plotting Delta Function

In summary, using PlotMarkers can help make delta functions visible in a plot by allowing you to customize their appearance. Additionally, you can try using PlotStyle to change the color of the delta function markers for better visibility.
  • #1
rynlee
45
0
Hi All,

I'm trying to plot some DiscreteDelta functions in mathematica but unfortunately since the points are singular nothing shows up in the plot.

Usually when this comes up I replace the delta functions with very narrow gaussians, graphically it looks even nicer (I'm plotting absorption spectra). This time, however, my delta functions are coming from the Fourier transform of Exp[it] i.e. complex oscillations, so mathematica is generating the delta functions (and so I can't replace them manually).

Does anyone have any tricks for getting mathematica to plot delta functions visibly? I tried Fill, no dice.

Thanks for any advice,
rynlee
 
Physics news on Phys.org
  • #2
You can try using PlotMarkers. This will allow you to set the size and shape of the markers that appear on the plot. You can also set the color for better visibility. Here's an example: data = Table[{i, DiscreteDelta[i - 2]}, {i, -4, 4, 0.2}];ListPlot[data, PlotMarkers -> {Graphics[{EdgeForm[Black], Yellow, Disk[{0, 0}, 0.1]}], 0.03}]
 

What is the Delta Function in Mathematica Plotting?

The Delta Function is a mathematical function that represents an infinitely narrow and tall spike at a particular point. It is often used in situations where a specific value needs to be emphasized or represented. In Mathematica, the Delta Function is denoted by the symbol "DiracDelta".

How do I plot the Delta Function in Mathematica?

To plot the Delta Function in Mathematica, you can use the "Plot" or "DiscretePlot" functions and specify "DiracDelta[x]" as the function to be plotted. You can also specify the location of the spike by adding a second argument, such as "DiracDelta[x, a]" where "a" is the location of the spike.

Can I use the Delta Function in combination with other functions in Mathematica plotting?

Yes, the Delta Function can be combined with other functions in Mathematica plotting. For example, you can use it to create a spike in a continuous function by adding it as a term, such as "f[x] + a*DiracDelta[x]". You can also use it to create a discrete function by specifying the location and height of the spike, such as "a*DiracDelta[x, 0] + b*DiracDelta[x, 1] + c*DiracDelta[x, 2]".

Are there any special considerations when plotting the Delta Function in Mathematica?

Yes, there are a few special considerations when plotting the Delta Function in Mathematica. One consideration is that the Delta Function is not a true function in the traditional sense, so it may not behave as expected in certain situations. Another consideration is that the Delta Function is not defined at "x = 0", so it may not appear on the plot if it is the only term in the function. In this case, you can specify a small value for "x" to plot the Delta Function at that point.

Are there any alternatives to using the Delta Function in Mathematica plotting?

Yes, there are alternative ways to create spikes or emphasize values in Mathematica plotting. One alternative is to use the "Piecewise" function, which allows you to define different functions for different ranges of "x". Another alternative is to use the "HeavisideTheta" function, which represents a step function and can be used to create a spike at a particular point.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
23
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
Back
Top