フィルターのクリア

Vectorize polyphase filter operation

1 回表示 (過去 30 日間)
Shannon Cherry
Shannon Cherry 2020 年 4 月 14 日
Hi, I have implemented a matlab code for polyphase filter. Is there any way I could vectorize/optimize this code by avoiding nested for loops?
clc;clear;close all;
% Input parameters
input = [2 4 6];
upSamplingFactor = 3;
% filter coefficients
h = 1:9;
%% Polyphase filter without any inbuilt libraries
% Y(n) = sum(X(i)*h(n-Li); where L = upFactor
outputLen = numel(input)*upSamplingFactor;
output = zeros(1,outputLen);
for outIndex = 1:outputLen
nextIndex = 0;
for loopIndex = 0:upSamplingFactor:outIndex-1
output(outIndex) = output(outIndex) + input(nextIndex+1)*h(outIndex-upSamplingFactor*nextIndex);
nextIndex = nextIndex + 1;
end
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by