Effacer les filtres
Effacer les filtres

floating point numbers are not allowed as holes. they should be converted to strings

4 vues (au cours des 30 derniers jours)
I do realize there are similar questions posted here, but mine is different. If I run the code, it will give me errors saying
But if I lower the bandwidth, centerfrequency, and itnerpolation factor in the hDUC and HDDC block, then the code works fine. I have also attached this version. Therefore I guess the problem is the number is too big. But I can only use double. I cannot convert number for bandwidth, centerfrequency, and interpolation factor to other format because digitalupconverter and digitaldownconverter can only accept double as input. How am I supposed to solve this problem?
Below is the version that has the value I want and it does not work.
m=2;
k=log2(m);
ebno=5;
freqsep=65536;
nsamp=32;
fs=6e6;
x = randi([0 m-1],10000,1);
y=fskmod(x,m,freqsep,nsamp,fs);
% h = dsp.SpectrumAnalyzer('SampleRate',fs);
% step(h,y)
hDUC = dsp.DigitalUpConverter(...
'InterpolationFactor', 800,...
'SampleRate', fs,...
'Bandwidth', 2e6,...
'StopbandAttenuation', 55,...
'PassbandRipple',0.2,...
'CenterFrequency',4.3e9);
hDDC = dsp.DigitalDownConverter(...
'DecimationFactor',800,...
'SampleRate', fs*800,...
'Bandwidth', 3e6,...
'StopbandAttenuation', 55,...
'PassbandRipple',0.2,...
'CenterFrequency',4.3e9);
% Create a spectrum estimator to visualize the signal spectrum before
% and after up converting.
window = hamming(floor(length(y)/10));
figure; pwelch(y,window,[],[],fs,'centered')
title('Spectrum of baseband signal y')
%
% Up convert the signal and visualize the spectrum
yUp = step(hDUC,y); % up convert
window = hamming(floor(length(yUp)/10));
figure; pwelch(yUp,window,[],[],50*fs,'centered')
title('Spectrum of up converted signal yUp')
%pass through AWGN channel
rxSig = awgn(yUp,ebno+10*log10(k)-10*log10(nsamp));
window = hamming(floor(length(rxSig)/10));
figure; pwelch(rxSig,window,[],[],50*fs,'centered')
title('Spectrum after awgn')
% Down convert the signal and visualize the spectrum
xDown = step(hDDC,rxSig); % down convert
window = hamming(floor(length(xDown)/10));
figure; pwelch(xDown,window,[],[],fs,'centered')
title('Spectrum of down converted signal xDown')
fskdemod=fskdemod(xDown,m,freqsep,nsamp,fs);
[num,ber]=biterr(x,fskdemod);
bertheory=berawgn(ebno,'fsk',m,'noncoherent');
[ber bertheory]
Below is the version that has the number that can run
clear all
close all
m=2;
k=log2(m);
ebno=5;
freqsep=65536;
nsamp=32;
fs=6e5;
x = randi([0 m-1],10000,1);
y=fskmod(x,m,freqsep,nsamp,fs);
% h = dsp.SpectrumAnalyzer('SampleRate',fs);
% step(h,y)
hDUC = dsp.DigitalUpConverter(...
'InterpolationFactor', 50,...
'SampleRate', fs,...
'Bandwidth', 2e5,...
'StopbandAttenuation', 55,...
'PassbandRipple',0.2,...
'CenterFrequency',4.3e6);
hDDC = dsp.DigitalDownConverter(...
'DecimationFactor',50,...
'SampleRate', fs*50,...
'Bandwidth', 3e5,...
'StopbandAttenuation', 55,...
'PassbandRipple',0.2,...
'CenterFrequency',4.3e6);
% Create a spectrum estimator to visualize the signal spectrum before
% and after up converting.
window = hamming(floor(length(y)/10));
figure; pwelch(y,window,[],[],fs,'centered')
title('Spectrum of baseband signal y')
%
% Up convert the signal and visualize the spectrum
yUp = step(hDUC,y); % up convert
window = hamming(floor(length(yUp)/10));
figure; pwelch(yUp,window,[],[],50*fs,'centered')
title('Spectrum of up converted signal yUp')
axis([4 5 -inf inf])
%pass through AWGN channel
rxSig = awgn(yUp,ebno+10*log10(k)-10*log10(nsamp));
window = hamming(floor(length(rxSig)/10));
figure; pwelch(rxSig,window,[],[],50*fs,'centered')
title('Spectrum after awgn')
% Down convert the signal and visualize the spectrum
xDown = step(hDDC,rxSig); % down convert
window = hamming(floor(length(xDown)/10));
figure; pwelch(xDown,window,[],[],fs,'centered')
title('Spectrum of down converted signal xDown')
fskdemod=fskdemod(xDown,m,freqsep,nsamp,fs);
[num,ber]=biterr(x,fskdemod);
bertheory=berawgn(ebno,'fsk',m,'noncoherent');
[ber bertheory]

Réponses (0)

Catégories

En savoir plus sur Test and Measurement dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by