Why am I getting "too many output arguments" when I am Quantizing an input speech?

1 visualización (últimos 30 días)
clear
clc
%----------------- Quantization -------------------------------------------
%Number of level
level=32;
%TYPE OF QUANTIZATION
% Choose to graph:
% 1 = Univorm
% 2 = Mu-law
% 3 = A-Law
option_quantization=1;
%----------------- Modulation ---------------------------------------------
%TYPE OF MODULATION
% Choose to graph:
% 1 = BPSK
% 2 = QPSK
% 3 = BPSK and QPSK
option_modulation=3;
%Loading voice
[x,fm]=audioread('4.m4a');
%Fundamental frequency
N=floor(0.02*fm);
C=xcorr(x,N,'coeff');
N1=floor(0.002*fm);
[x0,vmax]=max(C(N+N1:2*N+1));
t0=(vmax+N1)/fm;
f0=1/t0;
fundamental_frequency=strcat(num2str(f0),' Hz');
%PLOT
%Plotting input signals (voices)
figure(1)
plot(x)
axis([ 0 4500 min(x) max(x) ])
title('Input signal 1');
% Playing voices
disp('Playing input signals');
soundsc(x,fm);
pause(3);
%Quantization
[y1, x2, errorquantization] = quantize(x,option_quantization, level);
%Quantization error
quantization_error = strcat(num2str(errorquantization),' %');
%Variables to plot
xg=x2; yq=y1;
xq=x; fmq=fm;
Error I am getting:

Respuestas (1)

Yongjian Feng
Yongjian Feng el 26 de Nov. de 2021
It looks like quantize only returns one output, not 3
help quantize
  2 comentarios
Zanobia  Masih
Zanobia Masih el 26 de Nov. de 2021
What would be the best way to implement quantization for the above problem?
Adam Danz
Adam Danz el 26 de Nov. de 2021
@Zanobia Masih I removed the flag because this answer perfectly addresses your question. It looks like you have a new, more complicated question. You may be looking for the function quantiz but it's unclear what your inputs represent. Where did you get this code?

Iniciar sesión para comentar.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by