フィルターのクリア

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 Center および File ExchangeIntroduction 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