A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

**Technical discussion about Matlab and issues related to Digital Signal Processing.**

**Is this thread worth a thumbs up?**

I am a MATLAB newbie and i have a problem with a DSP project. How can i generate a rectangular pulse that will start from zero to 10nsec and have an amplitude of 1? I read somewhere how to center it around zero using FFTSHIFT before taking the FFT so that i can get a nice smooth sinc wave in frequency domain. But after a lot of effort i still can´t generate that pulse like i want. I will then try to filter it with a lowpass and recover it.I am trying to calculate the ideal number of points for sampling in order to avoid aliasing. Please help if you can....I spent many hours searching and i am counting on someone of you since you have more experience in those matters.

Thank you in advance,

Natasa

_____________________________

fs = 1e10; % 10 GHz sampling

ts = 1/fs;

t = 0:ts:10*1e-9;

Pulse = rectpuls(t); % 10ns Rect. pulse

To check the fft use

plot(linspace(-5*1e9,5*1e9,512),fftshift(abs(fft(Pulse,512))))

The first zero crossing of the main lobe of the sinc function should be at 0.1GHz.

Premal

natasa costopoulou <natasakostopoulou@nata...> wrote:

Hello!

I am a MATLAB newbie and i have a problem with a DSP project. How can i generate a rectangular pulse that will start from zero to 10nsec and have an amplitude of 1? I read somewhere how to center it around zero using FFTSHIFT before taking the FFT so that i can get a nice smooth sinc wave in frequency domain. But after a lot of effort i still can´t generate that pulse like i want. I will then try to filter it with a lowpass and recover it.I am trying to calculate the ideal number of points for sampling in order to avoid aliasing. Please help if you can....I spent many hours searching and i am counting on someone of you since you have more experience in those matters.

Thank you in advance,

Natasa

_____________________________

rectpuls is a signal processing toolbox function.

If you are using a basic matlab, use

pulse = ones(size(t));

this should also give you the same result, using the code suggested by premal

And the "fft" plot should include the phase information of the signal. I hope you can manage that. And your rectangular pulse is starting at t = 0, you should be

adjusting your phase information according to the time-shift of the signal. (FFT assumes that the signal is centered at t=0). And regarding the optimal number of samples, it is always better to perform DFT with a number greater than the size of the signal. The greater the number, better the resolution. To avoid aliasing, as this is aperiodic signal, use sampling rates higher than the inverse of the time width of the signal. The greater the sampling frequency, more the frequency content that can be observed.

Sivakanth. Premal Madhani <madhani777@madh...> wrote: Use the following code,

fs = 1e10; % 10 GHz sampling

ts = 1/fs;

t = 0:ts:10*1e-9;

Pulse = rectpuls(t); % 10ns Rect. pulse

To check the fft use

plot(linspace(-5*1e9,5*1e9,512),fftshift(abs(fft(Pulse,512))))

The first zero crossing of the main lobe of the sinc function should be at 0.1GHz.

Premal

natasa costopoulou <natasakostopoulou@nata...> wrote:

Hello!

I am a MATLAB newbie and i have a problem with a DSP project. How can i generate a rectangular pulse that will start from zero to 10nsec and have an amplitude of 1? I read somewhere how to center it around zero using FFTSHIFT before taking the FFT so that i can get a nice smooth sinc wave in frequency domain. But after a lot of effort i still can´t generate that pulse like i want. I will then try to filter it with a lowpass and recover it.I am trying to calculate the ideal number of points for sampling in order to avoid aliasing. Please help if you can....I spent many hours searching and i am counting on someone of you since you have more experience in those matters.

Thank you in advance,

Natasa

_____________________________