plotting dirac delta function using inverse Fourier transform
I don't think you did anything wrong. The problem is probably that a delta function is quite pathological, and the Matlab integral function can't handle things to sufficient numerical precision. Instead of a delta function, do a very narrow Gaussian pulse, which you can also Fourier transform analytically. Below is a shifted Gaussian pulse of width \$\Delta t=0.01\$

clear all; close all; clc;
t=linspace(-5,5,800);

for it=1:800

f=@(w)(1/pi).*(cos(w.*pi).*exp(-(w.*w*.0001/2)).*cos(w.*t(it))+ sin(w.*pi).*exp(-(w.*w*.0001/2)).*sin(w.*t(it)));
F(it)=integral(f,0,3000);

end

figure('Name','inverse Fourier transform');
plot(t,F,'red');
hold on;


Gives