 25th July 2005, 18:00 #1
 Join Date
 Mar 2003
 Posts
 28
 Helped
 0 / 0
 Points
 1,975
 Level
 10
generate sine wave in matlab
resolution 10bit, how to generate this binary or decimal digital sine wave using matlab command? I know litter about matlab, thanks.
 25th July 2005, 18:00
 26th July 2005, 05:23 #2
 Join Date
 Sep 2002
 Posts
 302
 Helped
 22 / 22
 Points
 9,373
 Level
 23
matlab generate sine wave
Hi
First you should create a time vector(e.g. t = 0 : ( 1 / fs) : 1000 / fs; % fs = sampling frequency).
Second you should create your sine vector(e.g. A = sin(2 * pi * f .* t); % f is sine frequency)
Third you should quantize the sine wave, so multiply A by 2 ^ 9 and round the result(i.e. AQ = round( A * 2 ^ 9); )
Regards
 26th July 2005, 05:23
 26th July 2005, 08:41 #3
 Join Date
 Mar 2003
 Posts
 28
 Helped
 0 / 0
 Points
 1,975
 Level
 10
generate sine wave matlab
thanks for your help!
But I have a question: A is [1,1], so A*2^9 is [2^9, 2^9], in other words, is [0, 2^10]. Actually, the 10bit digitizer can only be [0, 2^101]. How to do with overflow value? If I just discard them or replace them by 2^101, can it introduce distortion?
 26th July 2005, 08:41
 26th July 2005, 13:20 #4
 Join Date
 Sep 2002
 Posts
 302
 Helped
 22 / 22
 Points
 9,373
 Level
 23
generate digital wave sin
Hi
Usually we multiply A with (2 ^ 10  1).
Regards
 26th July 2005, 15:40 #5
 Join Date
 Mar 2003
 Posts
 28
 Helped
 0 / 0
 Points
 1,975
 Level
 10
generate a sine wave in matlab
A*(2^101) seems be differential output, but there is zero in it. In ideal differential output of 10bit digitizer, there should be no zero. How to get ideal singleend or differential output? Please give details.
Thanks very much.
LinkBacks (?)

Untitled document
Refback This thread19th November 2014, 04:50