这是IMDCT的编码。我不知道下面的matlab代码出了什么问题。以下行中的错误输入参数不足:
if blocksplit_flag(iter) && block_type(iter) == 2;
以下是完整编码的一部分:
function output_data = IMDCT( input_data, block_type, blocksplit_flag, switch_point)
global sin_window_0 sin_window_1 sin_window_2 sin_window_3;
output_data(1:4,1:576) = double(0);
output_holder(1:36) = double(0);
output_holder_1(1:36) = double(0);
output_holder_2(1:36) = double(0);
output_holder_3(1:36) = double(0);
block_type2_sum(1:3,1:12) = 0;
block_type2_sum_1(1:3,1:12) = 0;
block_type2_sum_2(1:3,1:12) = 0;
block_type2_sum_3(1:3,1:12) = 0;
persistent overlap_adder skipper;
if isempty(overlap_adder)
overlap_adder = zeros(2,576);
skipper = zeros(1,18);
end
for iter = 1:4
%decide channel to use the appropriate overlap_adder
if mod(iter,2) == 1;
channel = 1;
else
channel = 2;
end
if blocksplit_flag(iter) && block_type(iter) == 2;
current_start = 1;
current_start_2 = 2;
current_start_3 = 3;
if switch_point(iter)
%do long transform for first 2 sub_bands.
while (current_start <= 36 && current_start_2 <= 36 && current_start_3 <= 36)
output_holder(:) = 0;
output_holder_1(:) = 0;
output_holder_2(:) = 0;
output_holder_3(:) = 0;
temp_data = input_data(iter, current_start:current_start+17);
temp_data_1 = input_data(iter, current_start);
temp_data_2 = input_data(iter, current_start_2:current_start_2+16);
temp_data_3 = input_data(iter, current_start_3:current_start_3+15);
if temp_data == skipper
else
for i = 1:36
k1 = (current_start_2:current_start_2+16);
k2 = (current_start_3:current_start_3+15);
%output_holder(i) = ((temp_data_1 .* cos_imdct_long_1(i,:))+ ((cos_imdct_long_2(i,:)) .*sum((temp_data_2) .* (sin((k1)*((pi/72)*(2i+19))))))+ ((cos_imdct_long_3(i,:)) .* ((temp_data_3).*(sin((k2-2)*((pi/72)*(2i+19)))))))/(sin((pi/72)*(2i+19)));
output_holder_1(i) = (temp_data_1 .* (cos((pi/72).*(2i+19))));
output_holder_2(i) = ((cos(3.*((pi/72).*(2i+19)))) .* sum((temp_data_2).*(sin((k1).*((pi/72).*(2i+19))))));
output_holder_3(i) = ((cos((pi/72).*(2i+19))) .*sum((temp_data_3).*(sin((k2-2).*((pi/72).*(2i+19))))));
output_holder(i) = output_holder_1(i) + output_holder_2(i) + output_holder_3(i);
end
.
.
.
答案 0 :(得分:0)
如果您正在编写函数并在调用具有声明参数的函数(即(input_data, block_type, blocksplit_flag, switch_point)
作为参数)之前点击运行按钮,则会遇到此类错误。使用适当的输入调用函数可以解决问题。