Signal generation: random noise I have attempted question 1 a) below in MATLAB 6.5, but I need my answer to be checked. 


How do I do question 1 b) below ? 
What does it mean to have a zero mean?



  
  Generate the following signals with a computer program:
  
  
  a)   Random noise in the amplitude interval (0,0  1,0)
  b)   Random noise in the previous question but with a zero mean
  
  



function [] = Question1a()
datapoint = 1000;
t=0:1/datapoint:2;
x=sin(2*pi*5*t);
y=sin(2*pi*25*t);
z= x + y;
NoiseAmplitude = 1; 
Noise = x + NoiseAmplitude*randn(size(z));
plot(t,Noise);
title('Noise in the Amplitude interval (0,0,1,0)')
ylabel ('Amplitude')
xlabel ('Time(s)')
The phrase "zero mean" is primarily a phrase from the mathematical field of statistics.  For us, a "zero mean" sequence means a sequence of numbers whose mathematical average is zero.

By the way, MATLAB's randn(1,N) command does not generate exactly a zero mean sequence. It generates an N-length sequence of random numbers that fluctuate randomly above and below an amplitude of zero, but the sequence's mean is not guaranteed to be zero.  The larger is N the closer the average (mean) of randn(1,N) will be to zero.  Try these: 

mean(randn(1,5))  and  mean(randn(1,500))

I have no idea what "the amplitude interval (0,0 1,0)" means.