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:
Generate complex noise with given norm value

Subject: Generate complex noise with given norm value

From: Anindya G

Date: 18 Oct, 2013 20:00:15

Message: 1 of 12

Hello,

I am trying to generate complex Gaussian noise vector such that its Euclidean norm is within the range 0 to 2. One way I could generate this is by generating the real and imaginary values separately using randn function. I then put an additional constraint that the real and imaginary parts should not exceed +/-sqrt(2) in their values. However, this only puts a constraint on the individual elements of the vector. Is there a way to achieve this constraint on the norm of the vector?

Any help will be greatly appreciated.

Anindya.

Subject: Generate complex noise with given norm value

From: Bruno Luong

Date: 19 Oct, 2013 08:39:08

Message: 2 of 12

"Anindya G" wrote in message <l3s40f$10v$1@newscl01ah.mathworks.com>...
> Hello,
>
> I am trying to generate complex Gaussian noise vector such that its Euclidean norm is within the range 0 to 2. One way I could generate this is by generating the real and imaginary values separately using randn function. I then put an additional constraint that the real and imaginary parts should not exceed +/-sqrt(2) in their values. However, this only puts a constraint on the individual elements of the vector. Is there a way to achieve this constraint on the norm of the vector?
>
> Any help will be greatly appreciated.
>
> Anindya.

Gaussian noise can't have bounded norm by definition.
Bounded noises are therefore not a Gaussian.

Pick your camp.

Bruno

Subject: Generate complex noise with given norm value

From: Anindya G

Date: 19 Oct, 2013 11:10:08

Message: 3 of 12

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <l3tgfb$jb9$1@newscl01ah.mathworks.com>...
> "Anindya G" wrote in message <l3s40f$10v$1@newscl01ah.mathworks.com>...
> > Hello,
> >
> > I am trying to generate complex Gaussian noise vector such that its Euclidean norm is within the range 0 to 2. One way I could generate this is by generating the real and imaginary values separately using randn function. I then put an additional constraint that the real and imaginary parts should not exceed +/-sqrt(2) in their values. However, this only puts a constraint on the individual elements of the vector. Is there a way to achieve this constraint on the norm of the vector?
> >
> > Any help will be greatly appreciated.
> >
> > Anindya.
>
> Gaussian noise can't have bounded norm by definition.
> Bounded noises are therefore not a Gaussian.
>
> Pick your camp.
>
> Bruno

Hi Bruno,

I see your point. Thanks. I reformulated my problem and looks like I can add uniform complex noise too. But the bounded norm of the noise vector still remains a constraint. I guess my method of generating real and imaginary parts separately would still not work.

Anindya.

Subject: Generate complex noise with given norm value

From: Bruno Luong

Date: 19 Oct, 2013 12:08:06

Message: 4 of 12

n = 10000;
radius = 2;

% Engine
theta = rand(1,n)*(2*pi);
r = sqrt(rand(1,n))*radius;
x = r.*cos(theta);
y = r.*sin(theta);
z = x + 1i*y;

plot(z,'.')

% Bruno

Subject: Generate complex noise with given norm value

From: Anindya G

Date: 19 Oct, 2013 13:11:07

Message: 5 of 12

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <l3tsn6$ecf$1@newscl01ah.mathworks.com>...
> n = 10000;
> radius = 2;
>
> % Engine
> theta = rand(1,n)*(2*pi);
> r = sqrt(rand(1,n))*radius;
> x = r.*cos(theta);
> y = r.*sin(theta);
> z = x + 1i*y;
>
> plot(z,'.')
>
> % Bruno

Hi Bruno,

Thank you. This really works. Except that I don't understand the exact relation between norm(z, 2) and r. I understand I can manipulate norm(z, 2) by changing r. But if there is an exact relation between the two, it will be more helpful.

Thanks again.

Anindya.

Subject: Generate complex noise with given norm value

From: Bruno Luong

Date: 19 Oct, 2013 15:19:07

Message: 6 of 12

"Anindya G" wrote in message <l3u0db$fk8$1@newscl01ah.mathworks.com>...

>
> Thank you. This really works. Except that I don't understand the exact relation between norm(z, 2) and r. I understand I can manipulate norm(z, 2) by changing r. But if there is an exact relation between the two, it will be more helpful.

The exact relation is norm(z,2) = r

Bruno

Subject: Generate complex noise with given norm value

From: Anindya G

Date: 19 Oct, 2013 23:36:05

Message: 7 of 12

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <l3u7tb$jvr$1@newscl01ah.mathworks.com>...
>
> The exact relation is norm(z,2) = r
>
> Bruno

Hi Bruno,

Thank you for your reply.

I thought the same. But when I executed your code (n=10000, r=2), the norm(z,2) came out to be ~141.

For n=32, executing your code gives the norm(z,2) ~7.99 for r=2.0. However, the norm is close to 2 when r=0.5.

Anindya.

Subject: Generate complex noise with given norm value

From: Bruno Luong

Date: 20 Oct, 2013 10:52:06

Message: 8 of 12

The norm of a complex number can be obtained by abs() command.

norm() command does something different than what *you* expect.

Bruno

Subject: Generate complex noise with given norm value

From: Anindya G

Date: 20 Oct, 2013 12:30:07

Message: 9 of 12

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <l40ckm$7fo$1@newscl01ah.mathworks.com>...
> The norm of a complex number can be obtained by abs() command.
>
> norm() command does something different than what *you* expect.
>
> Bruno

Hi Bruno,

That's true. For a single complex number, its norm is indeed its modulus (obtained by abs() command). But, here I am concerned with the norm of the complex vector rather than the norm of a single complex number. The Euclidean norm of the complex vector has a similar definition as the Euclidean norm of a real vector:
Euclidean norm of real vector: (x1^2 + x2^2 + ... + xn^2)^1/2
Euclidean norm of complex vector: (|x1|^2 + |x2|^2 + ... + |xn|^2)^1/2, where |.| denotes the abs(.) of each of the individual elements of the complex vector. Using this definition of the norm, I don't get the norm of the complex vector to be equal to 'r' in your code.

Anindya.

Subject: Generate complex noise with given norm value

From: Bruno Luong

Date: 20 Oct, 2013 13:47:07

Message: 10 of 12

"Anindya G" wrote in message <l40icf$elc$1@newscl01ah.mathworks.com>...

>
> Hi Bruno,
>
> That's true. For a single complex number, its norm is indeed its modulus (obtained by abs() command). But, here I am concerned with the norm of the complex vector rather than the norm of a single complex number. The Euclidean norm of the complex vector has a similar definition as the Euclidean norm of a real vector:
> Euclidean norm of real vector: (x1^2 + x2^2 + ... + xn^2)^1/2
> Euclidean norm of complex vector: (|x1|^2 + |x2|^2 + ... + |xn|^2)^1/2, where |.| denotes the abs(.) of each of the individual elements of the complex vector. Using this definition of the norm, I don't get the norm of the complex vector to be equal to 'r' in your code.

Then you have to explain what you want to do z1, ..., zn are n realizations of random variable. There s no sense to consider them as a single complex vector.

I think you (or I) confuse of what being asked.

Bruno

Subject: Generate complex noise with given norm value

From: David Epstein

Date: 21 Oct, 2013 20:44:08

Message: 11 of 12

Maybe Anindya G is asking how to generate random vectors from a uniform distribution on a Euclidean ball of radius R, centred at 0, in Euclidean space of dimension N. In Anindya G's case, R=2. The condition that the vectors are complex correspond to N even.

I think one can do this as follows: the probability of a point lying in a concentric ball of radius r < R is x=(r/R)^N. Choose x randomly from the uniform distribution on [0,1]. This can be used to determine r = R * x^(1/N). Next choose the N-dimensional vector theta randomly from the standard normal distribution in dimension N (help mvnrnd), with identity covariance matrix and zero mean. Finally, the random vector that I suspect Anindya G is seeking would be r*theta/norm(theta,2). This would be reasonably fast. Matlab makes it easy to choose large numbers of such vectors simultaneously.

David Epstein

Subject: Generate complex noise with given norm value

From: Bruno Luong

Date: 21 Oct, 2013 22:55:10

Message: 12 of 12

I give a version in R^3 here:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/267150

Extension of this method The in C^m is (here a = 0, b = 2)

m = 10;
n = 10000;
a = 0;
b = 2;

s = randn(m,n) + 1i*randn(m,n);
r = (rand(1,n)*(b^m-a^m)+a^m).^(1/m);
c = r./sqrt(sum(s.*conj(s),1));
s = bsxfun(@times, s, c);

% Bruno

Tags for 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