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

조회 수: 1 (최근 30일)
Zanobia  Masih
Zanobia Masih 2021년 11월 26일
댓글: Adam Danz 2021년 11월 26일
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:

답변 (1개)

Yongjian Feng
Yongjian Feng 2021년 11월 26일
It looks like quantize only returns one output, not 3
help quantize
  댓글 수: 2
Zanobia  Masih
Zanobia Masih 2021년 11월 26일
What would be the best way to implement quantization for the above problem?
Adam Danz
Adam Danz 2021년 11월 26일
@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?

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

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by