[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Concatenation of shapeDigits



PureBytes Links

Trading Reference Links

Here's the formulca for a 2nd order IIR filter, as implemented by Tomasz in
the library:

// f0, f1, f2 are filter coefficients
// you can try 0.2, 1.4, -0.6
function IIR2(input, f0, f1, f2) {
	local result;
	result[0] = input[0];
	result[1] = input[1];
	for(i = 2; i < BarCount; i++) {
		result[i] =
		f0 * input[i] +
		f1 * result[i - 1] +
		f2 * result[i - 2];
	}
	return result;
}


Questions:

- If it's possible, can someone explain the meaning of the 3 coeficients, in
plain english? To put it differently, what do you do to to change the cutoff
frequency, without changing gain or filter Q? What do you do to change the Q
alone?

- In my brief research on the net, I found some applets for designing IIR
filters, ie, coming up with coefficient values for a given response spec.
However, I don't understand the relationship between the coefficients they
use and those above. For example, the applet here:
  http://www.dsptutor.freeuk.com/IIRFilterDesign/IIRFilterDesign.html
Gives results like this:
	Butterworth IIR filter
	Filter type: LP
	Passband: 0 - .05 Hz
	Order: 2
	Coefficients:
	a[0] = 2.467633E-8   b[0] = 1.0
	a[1] = 4.935266E-8   b[1] = -1.9999444
	a[2] = 2.467633E-8   b[2] = 0.99994445

- By ignorant analogy, it would seem that a 4th order IIR filter might be
built as below; can anyone confirm?

function IIR4(input, f0, f1, f2, f3, f4) {
	local result;
	result[0] = input[0];
	result[1] = input[1];
	result[2] = input[2];
	result[3] = input[3];
	for(i = 2; i < BarCount; i++) {
		result[i] =
		f0 * input[i] +
		f1 * result[i - 1] +
		f2 * result[i - 2] +
		f3 * result[i - 3] +
		f4 * result[i - 4];
	}
	return result;
}


Thanks,

Dave Merrill



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/