function f = lowpassFIR(sample)
%Calculates Finite Impulse Response low pass filter coefficient
%using the windowing methods as well
passEdge = 100;
StopbandAtt = 20;
passbandRip =.05;
transWidth = 10;
Fs = sample;
%Step One: select number of coefficients%
deltaF = transWidth/Fs;
%Normalize for each window
rectN = round(0.9/deltaF);
hannN = round(3.1/deltaF);
hammN = round(3.3/deltaF);
blackN = round(5.5/deltaF);
rectPos = rectN/2;
rectNeg = (rectPos*-1);
%For the Vector Array
%rect = rectNeg:rectPos;
deltaSum= passEdge + (transWidth/2);
deltaF2= deltaSum/Fs;
for i = [rectPos:rectNeg]
%iterate through each value and plug into function in for loop
%each output of the function will be stored into another array
f= 2*i;
end
end
我已經編輯它,並認爲這會工作,但我得到的錯誤...陣環MATLAB
錯誤lowpassFIR(6號線) passEdge = 100;
在調用 「/Users/sergiogonzalez-palavicini/Documents/MATLAB/lowpassFIR.m >lowpassFIR」期間沒有分配輸出參數「f」(也可能是其他參數)。
這不是很清楚.... – Oli
退房[此帖](http://stackoverflow.com/questions/758736/how-do-i-iterate-through-each-element-in -n-dimensional-matrix-in-matlab),它可能會有幫助 –
它取決於函數,如果它是矢量化的,那麼你可以簡單地執行'Y = f(rect)'。你能發佈實際功能嗎? – Dan