필터 지우기
필터 지우기

I have a matix having binary numbers [001;011;111;111] . How can i convert it to a matrix like [0 0 1 0 1 1 1 1 1 1 1 1]? I want to modulate but could not understand how to modulate the first matrix so i need to convert it into a bitstream. So please help

조회 수: 4 (최근 30일)
clear; clc;
data_size=100;
M=2;
freq_sep=500;
nsamp=6;
fs=10000;
n=2;
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);
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)

답변 (1개)

Walter Roberson
Walter Roberson 2012년 5월 8일
[001;011;111;111] is not binary numbers: it is a column array of decimal numbers. one. eleven. one hundred and eleven.
If instead your matrix is A = [0 0 1;0 1 1; 1 1 1; 1 1 1] then you want
t = A.';
B = t(:) .';
  댓글 수: 2
Mubasher
Mubasher 2012년 5월 8일
sir
I am implementing bfsk for an audio file of .wav format. For bfsk input to fskmod should be binary. I am having problem in quantizing the sampled audio file. If you please read the code and suggest something?
Walter Roberson
Walter Roberson 2012년 5월 8일
dec2bin() does not produce binary: it produces strings of '0' and '1'

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

카테고리

Help CenterFile Exchange에서 Communications Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by