IPB

Welcome Guest ( Log In | Register )

2 Pages V  < 1 2  
Reply to this topicStart new topic
Sampling of time-limited signals, Request for help
adamdea
post Sep 19 2013, 17:22
Post #26





Group: Members
Posts: 24
Joined: 31-August 11
Member No.: 93396



QUOTE (2Bdecided @ Sep 18 2013, 16:46) *
MATLAB does this...

[attachment=7642:matlabpic.gif]

It takes quite a few seconds to do it. Maybe Octave is busy, rather than waiting? I assume a basic...

figure
plot(1:10)

...plots something on your system?

Cheers,
David.

This is very interesting. I'm not sure what it shows, going back to my query.
It seems to me that on each line the x axis (frequency?) increases in scale by a factor of 4.
There seem to be evenly spaced sinc functions, but on each line the interval between them seems to increase by a factor of 4. I would have expected this to be what happened if the sampling interval in the time domain decreased by a factor of 4 (ie the sample rate increased 4 fold).

Can you help me (JJ?)with what this graph is intended to represent.

I was kind of expecting something that represented the effect of sampling at a constant rate but over a time period of varying length. Having pored over Morrison looking for the answer I have come to the conclusion that as the time interval increases the fourier transform of the sample train tends towards a series of deltas. This is intuitively obvious because the window ceases to exist; but is this becasue as the length of the rectangle tends to infinity it FT becomes a pulse at f=0?

Go to the top of the page
+Quote Post
saratoga
post Sep 19 2013, 17:54
Post #27





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



QUOTE (adamdea @ Sep 19 2013, 12:22) *
This is very interesting. I'm not sure what it shows, going back to my query.
It seems to me that on each line the x axis (frequency?) increases in scale by a factor of 4.
There seem to be evenly spaced sinc functions, but on each line the interval between them seems to increase by a factor of 4. I would have expected this to be what happened if the sampling interval in the time domain decreased by a factor of 4 (ie the sample rate increased 4 fold).


These are all done at the same sample rate, however in each case the length the interval sampled is increased by a factor of 4. This increases the resolution of the transform's points by a factor of 4, hence there are 4 times as many points between each sinc and you can see more clearly the shape of the sinc.

QUOTE (adamdea @ Sep 19 2013, 12:22) *
I was kind of expecting something that represented the effect of sampling at a constant rate but over a time period of varying length.


That is in fact what you are looking at, although in each case there are the same number of pulses (100), so extra samples beyond those are zero padded.

QUOTE (adamdea @ Sep 19 2013, 12:22) *
Having pored over Morrison looking for the answer I have come to the conclusion that as the time interval increases the fourier transform of the sample train tends towards a series of deltas. This is intuitively obvious because the window ceases to exist; but is this because as the length of the rectangle tends to infinity it FT becomes a pulse at f=0?


Thats slightly different than was shown here because this has the same number of pulses and then zero padding, rather than adding more pulses. But yes, if you add more and more pulses, that is what will happen. Changing the "1000" in that above code to "len" (so that the number of pulses is proportional to the length) will result in the bottom most plot showing a series of near-perfect delta functions.
Go to the top of the page
+Quote Post
Woodinville
post Sep 21 2013, 08:16
Post #28





Group: Members
Posts: 1402
Joined: 9-January 05
From: JJ's office.
Member No.: 18957



QUOTE (saratoga @ Sep 19 2013, 09:54) *
Thats slightly different than was shown here because this has the same number of pulses and then zero padding, rather than adding more pulses. But yes, if you add more and more pulses, that is what will happen. Changing the "1000" in that above code to "len" (so that the number of pulses is proportional to the length) will result in the bottom most plot showing a series of near-perfect delta functions.


Sorry for the typo (done v. end), I typed it into here on the fly.

And indeed, changing from 100 pulses to a full set of them was where I was headed next.

Which shows how as you get more and more and more length, the bandwidth gets narrower and narrower.

BUT when you have the same length, and a wider analysis, all you see is the same thing, with more detail. NOthing more is learned.


--------------------
-----
J. D. (jj) Johnston
Go to the top of the page
+Quote Post
adamdea
post Sep 23 2013, 12:33
Post #29





Group: Members
Posts: 24
Joined: 31-August 11
Member No.: 93396



QUOTE (saratoga @ Sep 19 2013, 17:54) *
QUOTE (adamdea @ Sep 19 2013, 12:22) *
This is very interesting. I'm not sure what it shows, going back to my query.
It seems to me that on each line the x axis (frequency?) increases in scale by a factor of 4.
There seem to be evenly spaced sinc functions, but on each line the interval between them seems to increase by a factor of 4. I would have expected this to be what happened if the sampling interval in the time domain decreased by a factor of 4 (ie the sample rate increased 4 fold).


These are all done at the same sample rate, however in each case the length the interval sampled is increased by a factor of 4. This increases the resolution of the transform's points by a factor of 4, hence there are 4 times as many points between each sinc and you can see more clearly the shape of the sinc.

QUOTE (adamdea @ Sep 19 2013, 12:22) *
I was kind of expecting something that represented the effect of sampling at a constant rate but over a time period of varying length.


That is in fact what you are looking at, although in each case there are the same number of pulses (100), so extra samples beyond those are zero padded.

QUOTE (adamdea @ Sep 19 2013, 12:22) *
Having pored over Morrison looking for the answer I have come to the conclusion that as the time interval increases the fourier transform of the sample train tends towards a series of deltas. This is intuitively obvious because the window ceases to exist; but is this because as the length of the rectangle tends to infinity it FT becomes a pulse at f=0?


Thats slightly different than was shown here because this has the same number of pulses and then zero padding, rather than adding more pulses. But yes, if you add more and more pulses, that is what will happen. Changing the "1000" in that above code to "len" (so that the number of pulses is proportional to the length) will result in the bottom most plot showing a series of near-perfect delta functions.

Hi JJ, Saratoga- sorry for the delay in replying but i was away for the weekend.
I'm sorry if I am being stupid but I am getting hopelessly confused by what exactly it is that JJ's example shows. I'm sure this is just my ignorance but I can't take in the lesson because I don't understand what I am being shown.

My query was about the effect of windowing a sample train. I'm afraid that I don;t understand what is going on in the example because the gap between the impulses in the frequency domain is changing. I'm afraid that my level of understand is limited to getting that the frequency interval between the impulses in the sample train must be the inversely proportional to the time interval. I'm confused by the fact that the gap between the impulses in the frequency domain is changing. I don't understand how this is consistent with the sample rate being constant. I appreciate that you have referred to there being the same number of pulses followed by zero padding. Do you mean that JJ's example represents a signal of length T samples over interval T and then sampled over a greater and greater interval, ie adding more and more samples, all of which have a value of 0.
This suggests to me that we are not looking at a windowed impulse train but at the result of the impulse train being applied to a particular signal(?)

Sorry if this is irritatingly obtuse, but I would be very grateful if you could help me out by explaining (slightly more slooowly) what it is I am looking at.

This post has been edited by adamdea: Sep 23 2013, 12:34
Go to the top of the page
+Quote Post
saratoga
post Sep 23 2013, 12:42
Post #30





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



The gap is actually constant in physical units, just the number of samples is changing (because the length of the window changes). Remember, longer window = more resolution = more samples = each sample covers a shorter interval.
Go to the top of the page
+Quote Post
adamdea
post Sep 23 2013, 12:46
Post #31





Group: Members
Posts: 24
Joined: 31-August 11
Member No.: 93396



QUOTE (drewfx @ Sep 19 2013, 17:22) *
It works in Octave here (after the corrections noted above).

Perhaps there is an issue with your Octave installation? What do have installed and what is your OS?

I am using win 8 professional. I installed octave 3.6.4. The command prompt says that it is "configured for "i-686-pc-mingw386""
Go to the top of the page
+Quote Post
adamdea
post Sep 23 2013, 13:34
Post #32





Group: Members
Posts: 24
Joined: 31-August 11
Member No.: 93396



QUOTE (saratoga @ Sep 23 2013, 12:42) *
The gap is actually constant in physical units, just the number of samples is changing (because the length of the window changes). Remember, longer window = more resolution = more samples = each sample covers a shorter interval.

Thanks for the very prompt reply.
Can we just start from the beginning.
If I sample at a constant rate (ie what we traditionally call a sample rate in Hertz or radians per second or something.) Then the sample train will be represented by a series of delta functions ion the time dmain and in the frequency domain also by a series of delta functions which will be at intervals of fs

What I know is that if this takes place in a limited time window then my sample train has to be convolved with the fourier transform of the window function. Thus the series of delta functions becomes a series of sinc functions (I think).

The only version of JJ's octave routine i have so far been able to see has been the one david posted. I have therefore not been able to fiddle with the variables myself.

I am getting the sense that you are telling me that the units on the x axis in some way represent units of resolution. Is that because what we are looking at is an FFT not a fourier trasnform as such?

I was sort of getting towards an idea that if we take a time limited function and model it as though it were periodic on the interval of the time limit then it would have a fourier series with a fundamental frequency based on the time interval, which would effectively mean that the FT would be a series of frequencies at multiples of the fundamental. Is this what you mean by resolution? is this is same as saying that we are sampling the frequency spectrum of the signal.

Does this mean that as soon as we are sampling for a limited time, we have to treat the signal as being periodic.

In any event back to JJ's example is the idea that you are showing that as we sample over a longer period the frequency resolution increases.

However if we are assuming that our result ( a limited number of samples) instead represents a finite number of non zero samples with zeros stretching on to infinity then we no longer would have a discrete series of freqncies but a spectrum. As the number of zeros increase the peaks and zeros on the sinc function get closer and closer so that we are sampling the spectrum more closely.

This post has been edited by adamdea: Sep 23 2013, 13:36
Go to the top of the page
+Quote Post
adamdea
post Sep 23 2013, 13:48
Post #33





Group: Members
Posts: 24
Joined: 31-August 11
Member No.: 93396



QUOTE (Woodinville @ Sep 21 2013, 08:16) *
QUOTE (saratoga @ Sep 19 2013, 09:54) *
Thats slightly different than was shown here because this has the same number of pulses and then zero padding, rather than adding more pulses. But yes, if you add more and more pulses, that is what will happen. Changing the "1000" in that above code to "len" (so that the number of pulses is proportional to the length) will result in the bottom most plot showing a series of near-perfect delta functions.


Sorry for the typo (done v. end), I typed it into here on the fly.

And indeed, changing from 100 pulses to a full set of them was where I was headed next.

Which shows how as you get more and more and more length, the bandwidth gets narrower and narrower.

BUT when you have the same length, and a wider analysis, all you see is the same thing, with more detail. NOthing more is learned.

JJ am I right in thinking that what you are saying is
if you have 100 samples and treat these as being part of a set which has 100 non zero values ad lots more zero values then you get a continuous spectrum albeit that you have no more information than if you had assumed that the signal was periodic over the 100 sample interval.

if however you sample over a longer interval (1000 samples) you will genuinely know more of the values of spectrum, albeit that you will only know the values within the discrete portions. This will give you more precision although not as much resolution as if you extended the (100 sample) window beyond the actual samples (say to 10000 samples?)

This post has been edited by adamdea: Sep 23 2013, 13:48
Go to the top of the page
+Quote Post
saratoga
post Sep 23 2013, 13:59
Post #34





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



I think you should figure out how to install octave so you can see for yourself. The idea of giving you code instead of just telling you the answer is that you can learn more by trying these things and seeing what happens. The octave project probably has install directions or a mailing list you can check.
Go to the top of the page
+Quote Post
adamdea
post Sep 23 2013, 14:06
Post #35





Group: Members
Posts: 24
Joined: 31-August 11
Member No.: 93396



QUOTE (saratoga @ Sep 23 2013, 13:59) *
I think you should figure out how to install octave so you can see for yourself. The idea of giving you code instead of just telling you the answer is that you can learn more by trying these things and seeing what happens. The octave project probably has install directions or a mailing list you can check.

Fair point. I have a feeling that the problem is something to do with octave opening a graphics window. I can get it to do arithmetic.

Also if I can persuade Mathworks to sell me a licence I will be able to use mathlab.
Go to the top of the page
+Quote Post
saratoga
post Sep 23 2013, 15:04
Post #36





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



matlab is quite expensive, and only marginally less slow and buggy. For that reason I'd probably use octave unless you're going to be spending a lot of time with matlab.
Go to the top of the page
+Quote Post
Martel
post Sep 23 2013, 16:41
Post #37





Group: Members
Posts: 535
Joined: 31-May 04
From: Czech Rep.
Member No.: 14430



I used Matlab a lot during my college studies (automated system control/cybernetics), the university provided limited license copies to students. It was great. When I later tried doing some PCM wave DSP in Octave, all I got were constant freezes and crashes. This was about 3 years ago. Maybe Octave improved since then but I'm not wasting my time with it again...

This post has been edited by Martel: Sep 23 2013, 16:42


--------------------
IE4 Rockbox Clip+ AAC@192; HD 668B/HD 518 Xonar DX FB2k FLAC;
Go to the top of the page
+Quote Post
knutinh
post Sep 23 2013, 19:35
Post #38





Group: Members
Posts: 568
Joined: 1-November 06
Member No.: 37047



QUOTE (Martel @ Sep 23 2013, 16:41) *
I used Matlab a lot during my college studies (automated system control/cybernetics), the university provided limited license copies to students. It was great. When I later tried doing some PCM wave DSP in Octave, all I got were constant freezes and crashes. This was about 3 years ago. Maybe Octave improved since then but I'm not wasting my time with it again...

I believe that a popular open/free alternative to MATLAB is Python with the numPy/Scipy/.. packages.

It is not as syntactically equivalent to MATLAB as Octave, but it seems to be an intuitive matrix/vector package on its own. If you learn it, you will have developed a skill that can be used for many tasks.

The biggest drawback of Python and Octave vs MATLAB according to my own limited experience with the 2 first is the lack of a nice IDE. The ability to insert conditional break-points anywhere, continue prototyping code in the command-line (while breaking), rich plotting tools, lots of feedback in the editor, profiling tools etc makes MATLAB my tool of choice.

-k
Go to the top of the page
+Quote Post
julf
post Sep 23 2013, 19:56
Post #39





Group: Members
Posts: 176
Joined: 14-January 12
Member No.: 96426



QUOTE (knutinh @ Sep 23 2013, 20:35) *
I believe that a popular open/free alternative to MATLAB is Python with the numPy/Scipy/.. packages.


There is also another almost-MATLAB-compatible open source package, scilab.
Go to the top of the page
+Quote Post
adamdea
post Sep 23 2013, 21:02
Post #40





Group: Members
Posts: 24
Joined: 31-August 11
Member No.: 93396



Thanks to all for your comments. I think they will sell me a mathlab home use licence for 60 which I can live with. They are a bit slow though - I have now been accepted (afte 2 emials two phone calls and an online application form) but have to wait 2 business days for an email telling me how to download. It does seem like heavy weather. I have bought a car quicker.
Go to the top of the page
+Quote Post
drewfx
post Sep 23 2013, 23:33
Post #41





Group: Members
Posts: 65
Joined: 17-October 09
Member No.: 74078



QUOTE (adamdea @ Sep 23 2013, 07:46) *
QUOTE (drewfx @ Sep 19 2013, 17:22) *
It works in Octave here (after the corrections noted above).

Perhaps there is an issue with your Octave installation? What do have installed and what is your OS?

I am using win 8 professional. I installed octave 3.6.4. The command prompt says that it is "configured for "i-686-pc-mingw386""



OK, I haven't kept up to know the current state of things, but as of a few months ago (3.6.2) there were problems with Octave on Win8. Some have resorted to run it under a Windows XWin server, but as a workaround adding some command line options to the shortcut got it working here:

............\octave.exe -i --line-editing
Go to the top of the page
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 24th April 2014 - 10:20