MATLAB only
Use MATLAB to Plot the different representations of the Dirac Delta Function δ(x). Provide FIGURES.
Plot for different representations:
f1(blue), f2(red), f3(yellow), where functions are defined in MATLAB code below:
MATLAB Code:
x = linspace(-0.5,0.5,1000);
f1=zeros(1,1000);
f2=zeros(1,1000);
f3=zeros(1,1000);
e=0.04;
for i=1:1000
if(x(i)>-e)&&(x(i)<e)
f1(i)=1.0/(2.0*e);
else
f1(i)=0.0;
end
end
plot(x,f1)
hold on;
e=0.001;
for i=1:1000
f2(i)=exp(-(x(i)*x(i))/(2*e))/sqrt(2*pi*e);
end
plot(x,f2)
hold on
hold on;
e=0.001;
for i=1:1000
f2(i)=exp(-abs(x(i))/e)/sqrt(2*e);
end
plot(x,f2)
Get Answers For Free
Most questions answered within 1 hours.