Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
sampling rate

Subject: sampling rate

From: Konst

Date: 19 Jun, 2011 18:51:02

Message: 1 of 4

I have a signal which is plotted using data from rand(N,1).What is the sampling rate?Does matlab have a default sampling rate? And if so, how can I change it? In the program I calculate a variable w which is a column-vector and plot the gaussian. If I change the sampling rate how can i plot the gaussian again to compare the two results? Is it at all possible?
Thanks in advance.

Subject: sampling rate

From: Wayne King

Date: 19 Jun, 2011 19:30:21

Message: 2 of 4

"Konst " <konstance1@hotmail.com> wrote in message <itlgem$ltu$1@newscl01ah.mathworks.com>...
> I have a signal which is plotted using data from rand(N,1).What is the sampling rate?Does matlab have a default sampling rate? And if so, how can I change it? In the program I calculate a variable w which is a column-vector and plot the gaussian. If I change the sampling rate how can i plot the gaussian again to compare the two results? Is it at all possible?
> Thanks in advance.

Hi Konstance,
There is no sampling rate associated with a discrete-time sequence inherently.

A white-noise vector has a theoretical power spectral density which is constant over the entire frequency interval, so it does not matter how you view randn(N,1). You can think of that process as sampled with whatever rate you wish.

Changing the sampling rate when you evaluate some function such as cos() amounts to changing the spacing between the angles you evaluate that function at.

t = 0:0.001:1;
y = cos(2*pi*250*t);

If you just want to add white noise to the above signal sampled at 1 kHz:

y = cos(2*pi*250*t)+randn(size(t));

Note that I have just used randn(size(t)) to add the white noise.

Wayne

Subject: sampling rate

From: Konst

Date: 19 Jun, 2011 20:50:14

Message: 3 of 4

I don't quite get it myself so here are some details.I take my data X randomly from the uniform distribution.Then I make this initial signal to have only 0 and 1 values(first I put as many zeros as there are in X(1), then as many ones as in X(2) etc).Let's call this vector a. Then I use the box muller method and I take some new data Y which I add as noise to the signal: a=a+y and then I do some calculations using the a. Does sampling rate make any sense in all these?I've been asked to comment how the sampling rate affects my data

Subject: sampling rate

From: Wayne King

Date: 19 Jun, 2011 21:42:04

Message: 4 of 4

"Konst " <konstance1@hotmail.com> wrote in message <itlne6$8qc$1@newscl01ah.mathworks.com>...
> I don't quite get it myself so here are some details.I take my data X randomly from the uniform distribution.Then I make this initial signal to have only 0 and 1 values(first I put as many zeros as there are in X(1), then as many ones as in X(2) etc).Let's call this vector a. Then I use the box muller method and I take some new data Y which I add as noise to the signal: a=a+y and then I do some calculations using the a. Does sampling rate make any sense in all these?I've been asked to comment how the sampling rate affects my data

Are you sure you are talking about sampling rate here and not sampling from a probability distribution? The Box-Muller generates standard normal variables by sampling from a uniform distribution.

Wayne

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us