How to plot this function in Matlab:
$S(f)=1+\frac{1}{4}(\delta(f+2f{_1})+\delta(f-2f{_1})-\delta(f+2f{_2})+\delta(f-2f{_2}))$
Thanks for any advice!
How to plot this function in Matlab:
$S(f)=1+\frac{1}{4}(\delta(f+2f{_1})+\delta(f-2f{_1})-\delta(f+2f{_2})+\delta(f-2f{_2}))$
Thanks for any advice!
Copyright © 2021 JogjaFile Inc.
Your "delta" function will be a limitting square impulse $$\delta(x_0) = \lim_{\epsilon\to 0}\frac{1}{2\epsilon}\left[\mathcal{H}(x_0-\epsilon)-\mathcal{H}(x_0+\epsilon)\right]$$ Where $\mathcal{H}(x)$ is the heaviside function, defined in matlab as "heaviside(x)". Because you want an approximation of the Dirac delta, fix the parameter $\epsilon$, as tiny you want, and plot the function of $x$ $$f(x) = \frac{1}{2\epsilon}\left[\mathcal{H}(x-x_0-\epsilon)-\mathcal{H}(x-x_0+\epsilon)\right]$$ That in matlab writes: $$ f= (heaviside(x-x0-eps)-heaviside(x-x0+eps))/(2*eps)$$ $$plot(x,f)$$ Once defined $x0$ ans $eps$. The height of this impulses is not $1$, but its integral.
Summing up, if you want an impulse with size $1/4$ (but not height, remember that) at $x_0$ you have to write $$ f_{1/4}=\frac{1}{4}(heaviside(x-x0-eps)-heaviside(x-x0+eps))/(2*eps)$$