# Modulating Gaussain Pulse

I'm trying to generate a modulated Gaussian pulse. First I'm generating the pulse in the time domain perform FFT and displaying both in time and frequency, then I'm multiplying it with cosine term (which is related to distance measurement - Interferometry). The modulated pulse seems undersampled, I tried to increase 'L', still doesn't look to what I look for. I also trying to rescale all the parameters, but I stuck with some of them.

clear all; close all;
f=374.7e12;%Hz
fs=f*10; %sampling frequency
T=1/fs;
L=4000;
sigma=40e-15;
t=(0:L-1)*T; %time base

x=(exp(-(t-400e-15).^2/(2*sigma)^2)).*exp(1i*2*pi*f*t);
subplot(2,1,1)
plot(t,real(x),'b');
title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);
xlabel('Time(s)');
ylabel('Amplitude');
ylim([-1 1])
% xlim([1e-15 9e-15])

NFFT = 2^nextpow2(L);
X = fft(x,NFFT)/L;
Pxx=X.*conj(X)/(NFFT*NFFT); %computing power with proper scaling
f = fs/2*linspace(0,1,NFFT/2+1); %Frequency Vector
subplot(2,1,2)

plot(f,2*abs(X(1:NFFT/2+1)))
title('Magnitude of FFT');
xlabel('Frequency (Hz)')
ylabel('Magnitude |X(f)|');

Cav_len=0.3;%Meter
delta_L=-40e-6;
fr=1e9; %Hz
c=3e8;  %m/s
n=1:1:NFFT;
m=500;

S_w=abs(X).^2.*(1+cos((2.*pi.*n.*m.*fr.*Cav_len./c)+(2.*pi.*fr.*n.*delta_L./c)));
figure()
plot(f,2*S_w(1:NFFT/2+1))
xlim([3.6e14 3.9e14])  The attached images: The first is what I expected , The second is what I get. The terms source is from thesis that I am reading and trying to implement some of the theory. I will attach to relevant pages,  • Your code mixes extremely small (400e-15) and very large constants. You're probably seeing a lot of inaccuracy in your calculations because of that. Also, when simulating, it's seldom useful to actually simulate a modulated signal. You can use the complex envelope, which is equivalent in most ways to the modulated signal, without having to worry about the carrier frequency. – MBaz Jan 4 '15 at 17:24
• "Also, when simulating, it's seldom useful to actually simulate a modulated signal" - did not understand why, what is the meaning ? I'll read about the complex envelop, Thx – UdiW Jan 5 '15 at 6:48
• I'll think it will become clearer when you read more about the complex envelope. The idea is that if you have a system with a high carrier frequency, you can model it as having a carrier frequency equal to zero. This can reduce drastically the number of samples you need and thus, reduce computational requirements and simulation time. In your case this may also help with computer arithmetic, since you may avoid such large/small numbers. – MBaz Jan 5 '15 at 18:10
• Still reading about the complex envelope - from wikipedia I'm able to understand that I should scale down the frequency , because $\gamma(t)$ still holds $\omega_0$, but how can I deduce from the scaling to the values I should assign for the repetition rate/light speed/lengths ? – UdiW Jan 8 '15 at 14:41