I've been experimenting with ChatGPT and wondered if it could answer this question on main.
So I pasted the whole question text into the ChatGPT interface:
In MATLAB, I have generated an FIR low pass and high pass filter of order 16. The code is as follows:
filter1 = fir1(16,400/16000,'low') %%pass band-400Hz, Sampling frequency-16000Hz filter2 = fir1(16,800/16000,'high') %%pass band-600Hz, Sampling frequency-16000Hz
The sum of coefficients of low pass filter adds to 1 whereas the sum of filter coefficients of high pass filter does not add to 1. Shouldn't the sum of filter coefficients add to 1?
and it came up with this response:
It is not necessarily the case that the sum of the coefficients of an FIR filter should add up to 1. In fact, for many types of FIR filters, the sum of the coefficients will not be equal to 1.
In the case of the low pass filter you have created using the fir1 function, the sum of the coefficients does happen to be equal to 1. This is because the fir1 function by default uses a windowing technique to design the filter, which can cause the sum of the coefficients to be equal to 1. However, this is not always the case, and it is possible to design FIR filters using fir1 with other windowing techniques that do not result in a sum of 1 for the coefficients.
For the high pass filter you have created, it is not necessarily the case that the sum of the coefficients should be equal to 1. High pass filters have a different frequency response than low pass filters, and as a result, the coefficients of a high pass filter will typically be different from those of a low pass filter. It is possible that the sum of the coefficients of your high pass filter does not equal 1, but this is not necessarily a problem with your filter design.
ChatGPT answers on SO have been banned, but I wondered what people think of this specific example?
The answer is correct as far as it goes, but it doesn't seem to exhibit any understanding of the deeper details of why it's correct. Hardly surprising, given that the machine is a Large Language Model, so I would expect the language to be good but not necessarily an understanding of nuance.
Kinda like some people, really? :-)