0
$\begingroup$

I have a function defined like: $$x(t)=2e^{-\frac{r}{2}t}\sin\left(\frac{1}{2}\sqrt{16\pi^2-r^2}\cdot t\right)\left(\frac{\Theta(t)}{\sqrt{16\pi^2-r^2}}\right) $$ Where $\Theta(t)$ is the Heaviside Theta funcion. If I perform the Fourier Transform of x(t) I have: $$X(\omega)=\frac{2 \sqrt{\frac{32 \pi -\frac{1}{2 \pi }}{16 \pi ^2-\frac{1}{4}}}}{-4 \omega^2-2 i \omega+16 \pi ^2}$$ Now I define on Matlab $t=linspace(0,10,2^8)$, and $y=fft(x(t))$ and try to plot the analytical $X(\omega)$ with the coefficient by fft but but they are differnt. Can someone suggest me a good way to do?

Here is my code :

  x=@(t)2*e.^(-r/2*t).*sin(1/2*sqrt(16*pi^2-r.^2).*t).*... 
  (1*heaviside(t))./(sqrt(16*pi^2-r.^2)); 
  e=exp(1); M=1; K=4*pi^2; C=1/2; 
  om=sqrt(4*K-C^2)/2; t=linspace(0,10,2^7);
  punti=x(t); N=length(punti); FFT=fft(punti); 
  pseudoperiodo=2*pi/om; 
  dw=(2*pi)/pseudoperiodo; 
  N=length(punti); FFT=FFT/N; % calculate coefficient 
  w=dw*[[0:N/2],-[N/2-1:-1:1]]'; 
  figure
  plot(w(1:N/2+1),abs(FFT(1:N/2+1)),'o') 
  figure
  G=tf(1,[M C K]); bode(G)
$\endgroup$
  • $\begingroup$ You are going to have provide more details about how they are different and your source code so that others can reproduce the problem. $\endgroup$ – AnonSubmitter85 Nov 6 '18 at 23:38
  • $\begingroup$ x=@(t)2*e.^(-r/2*t).*sin(1/2*sqrt(16*pi^2-r.^2).*t).*(1*heaviside(t))./(sqrt(16*pi^2-r.^2)); e=exp(1); M=1; K=4*pi^2; C=1/2; om=sqrt(4*K-C^2)/2; t=linspace(0,10,2^7); punti=x(t); N=length(punti); FFT=fft(punti); pseudoperiodo=2*pi/om; dw=(2*pi)/pseudoperiodo; N=length(punti); FFT=FFT/N; % calculate coefficient w=dw*[[0:N/2],-[N/2-1:-1:1]]'; figure plot(w(1:N/2+1),abs(FFT(1:N/2+1)),'o') figure G=tf(1,[M C K]); bode(G) $\endgroup$ – Alessio Bocci Nov 6 '18 at 23:45
  • $\begingroup$ I am sorry, but that is unreadable. Please edit your question and make sure it formatted so that others can read it without much effort. You are much more likely to get help that way. $\endgroup$ – AnonSubmitter85 Nov 7 '18 at 1:16
  • $\begingroup$ I have taken the liberty to include your code into your question for an improved readability. $\endgroup$ – Jean Marie Nov 15 '18 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.