Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If we multiply a Continuous-Time signal f(t) by a periodic pulse sequence we can get a sampled version of our signal. The problem I am having is that I am unsure how to create an impulse train in MATLAB that is sampled at fs intervals.

My Attempt at solution (code):

Ts = 1/8000
len = length(inputSignal)
impulseTrain = ones(1,len)
n = 0:Ts:Ts*(len-1)

What I need to do:

conv(inputSignal,impulseTrain)

Okay,so if I was to plot this result it would be very simple however, what I am required to do is convolve this impulse train with an input signal. I am unsure how to pass in the data. How do I get 23000 vectors of length 1 shifted by a distance Ts?

share|improve this question

bumped to the homepage by Community 3 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

When you load a signal, it is already sampled. So continuous-time does not make much sense here. Creating an impulse train and convolving it cannot help you either. You should know the sampling rate of the signal you are going to load. Assume it is originally sampled at the rate $f_{s,\text{old}}$. This means the samples are apart in time by $1/f_{s,\text{old}}$ seconds.

Now you want to sample this signal with a sampling rate of $f_{s,\text{new}}$. That is, in the sampled signal you will have $1/f_{s,\text{new}}$ seconds time difference between every two consecutive samples. This problem is called resampling, or sampling rate conversion. There are different techniques to do so which you can learn in the given link or similar sources.

A quick approach to do it in Matlab is as follows:

old_fs = 11200; % or any other value it is
old_time_axis = (0:length(input_signal)-1)/old_fs;
new_fs = 8000; % new sampling rate
[p,q] = rat(new_fs/old_fs); %find the ratio of the sampling rates
resampled_signal = resample(input_signal,p,q);
new_time_axis = (0:length(resampled_signal)-1)/new_fs;

Notice that at sharp signal edges distortion can appear. You can minimize such effects, depending on your signal, by adjusting the resampling filter. Documentation can be found here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.