Sign in

Not a member? | Forgot your Password?

Search matlab

Search tips

Find us on Facebook!





Subscribe to matlab

Search tips

Free PDF Downloads

A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

C++ Tutorial

Introduction of C Programming for DSP Applications

Fixed-Point Arithmetic: An Introduction

Cascaded Integrator-Comb (CIC) Filter Introduction

Discussion Groups

FFT Spectral Analysis Software

See Also

Embedded SystemsFPGA

Discussion Groups | Matlab DSP | How can i generate a rectangular pulse to get a nice smooth sinc wave?


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

  

Post a new Thread



Is this thread worth a thumbs up?

0

How can i generate a rectangular pulse to get a nice smooth sinc wave? - natasa costopoulou - Dec 12 8:02:00 2005

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






Re: How can i generate a rectangular pulse to get a nice smooth sinc wave? - Premal Madhani - Dec 13 16:20:00 2005

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






Re: How can i generate a rectangular pulse to get a nice smooth sinc wave? - Venkata Sivakanth Telasula - Dec 14 17:10:00 2005

Hi,

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