필터 지우기
필터 지우기

Can analog to digital conversion is implemented in matlab (not simulink)?

조회 수: 4 (최근 30일)
clear;
clc;
data_size=100;
M=2;
freq_sep=500;
nsamp=6;
fs=10000;
y=wavread('voice');
partition=[-.8,-.6,-.5,-.4,-.3,-.2,-.1,0,.1,.2,.3,.4,.5,.6,.8];
codebook=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
% Now optimize, using codebook as an initial guess.
[partition2,codebook2] = lloyds(y,codebook);
[index,quants,distor] = quantiz(y,partition,codebook);
[index2,quant2,distor2] = quantiz(y,partition2,codebook2);
%Compare mean square distortions from initial and optimized
[distor, distor2] % parameters.
quantization=dec2bin(quants,4);
x=str2num(quantization,1);
fsk_mod=fskmod(x,M,freq_sep,nsamp,fs);
noise=awgn(fsk_mod,0);
fsk_demod=fskdemod(noise,M,freq_sep,nsamp,fs);
[num,rate]=biterr(quants,fsk_demod)
%sound(fsk_demod)

채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 8일
Analog to digital conversion requires hardware to do the conversion, and so cannot be done by the MATLAB programming language itself. However, MATLAB offers interfaces to a number of kinds of A/D hardware, anywhere from microphone input to high-speed external-triggered boards. The more complex facilities are part of the Data Acquisition Toolbox.
If you could be more specific about your A/D hardware or about your conversion needs, someone might be able to offer more specific assistance.
  댓글 수: 5
Walter Roberson
Walter Roberson 2012년 5월 9일
Have you considered reading the file using the 'native' option of wavread() ? You would probably (but not certainly) get an integer data stream as a result instead of a floating point stream. Then if you have the signal processing toolbox (I think it is), de2bi() to get the corresponding numeric bits for each integer.
Mubasher
Mubasher 2012년 5월 9일
thanks. It helped me alot. I should start reading things more.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 5월 9일
dec2bin() does not produce binary. dec2bin() produces character strings. "binary" as needed for signal processing is always numeric, never character. You must stop using dec2bin() and use something else instead, or you must find a way of converting the output of dec2bin() into numeric binary.

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by