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

1 view (last 30 days)
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:

Answers (1)

Yongjian Feng
Yongjian Feng on 26 Nov 2021
It looks like quantize only returns one output, not 3
help quantize
  2 Comments
Adam Danz
Adam Danz on 26 Nov 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?

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!