
Anyone can please help me with my matlab program to quatize x(t)
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
quatize x(t) using 4 bits to obtain and plot the quantized signal xq, assuming the signal range is between -5 and 5 volts
the error: 'biquant' undefined near line 11 column 20, but i don't know how to solve it
clear all; close all
disp("Generate 0.02-second sine wave of 100 Hz and Vp=5");
fs = 8000; % Sampling rate
T = 1/fs; % Sampling interval
t = 0:T:0.02; % Duration of 0.02 second
sig = 4.5*sin(2*pi*100*t); % Generate sinusoids
bits = input("input number of bits =>");
lg = length(sig); % Length of signal vector sig
for x = 1:lg
[Index(x), pq] = biquant(bits, -5,5, sig(x)); % Output quantized index
end
% transmitted
% received
for x=1:lg
qsig(x) = biqtdec(bits, -5,5, Index(x)); % Recover the quantized value
end
qerr = qsig-sig; % Calculate quantized error
stairs(t,qsig); hold % Plot signal in staircase style
plot(t,sig); grid; % Plot signal
xlabel("Time (sec.)"); ylabel("Quantized x(n)")
disp("Signal to noise ratio due to quantization noise")
snr(sig,qsig);
0 Commenti
Risposta accettata
Ameer Hamza
il 1 Apr 2020
biquant and biqtdec are not built-in MATLAB functions. You need to download them from here:
and
and place it in the current folder and try to run the code again.

6 Commenti
ANUPRIYA LENEKAR
il 7 Dic 2021
when we run the program the command place enter the n bits when we enter bits then error occur biquant bits plzz suggest
Più risposte (2)
Aissa blk
il 12 Feb 2021
le lien que vouz avez donner ne fonctionne pas (pour telecharger fonction bitquant)
0 Commenti
ibrahim
il 30 Nov 2022
clear all; close all
disp('Generate 0.02-second sine wave of 100 Hz and Vp=5');
fs=8000; % Sampling rate
T=1/fs; % Sampling interval
t=0:T:0.02; % Duration of 0.02 second
sig = 4.5*sin(2*pi*100*t); % Generate sinusoids
bits = input('input number of bits =>');
lg = length(sig); % Length of signal vector sig
for x=1:lg
[sig(x) pq] = biquant(bits, -5.5, sig(x)); % Output quantized index
end
% transmitted
% received
for x=1:lg
qsig(x) = biqtdec(bits, -5,5, Index(x)); % Recover the quantized value
end
qerr = qsig-sig; % Calculate quantized error
stairs(t,qsig); hold % Plot signal in staircase style
plot(t,sig); grid; % Plot signal
xlabel('Time (sec.)'); ylabel('Quantized x(n)')
disp('Signal to noise ratio due to quantization noise')
snr(sig,qsig);
0 Commenti
Vedere anche
Categorie
Scopri di più su Signal Processing Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!