Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to generate a digital sine wave in matlab?

Status
Not open for further replies.

showtime

Junior Member level 3
Joined
Mar 10, 2003
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
238
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.
 

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
 

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^10-1]. How to do with overflow value? If I just discard them or replace them by 2^10-1, can it introduce distortion?
 

generate digital wave sin

Hi

Usually we multiply A with (2 ^ 10 - 1).

Regards
 

generate a sine wave in matlab

A*(2^10-1) 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 single-end or differential output? Please give details.
Thanks very much.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top