# Determine proper coefficients for the transfer function

The problem says that we have the information (actually a .mat file that contains the data) of 1 pixel from an IR camera from an object with 26° of temperature. Because of the noise, the output is given by

$$y[n]=26+N[n]$$ where $N[n]$ represents the noise. For that, I'm supposed to implement the following filter: $$H[z]=\frac{b}{1-az^{-1}}$$ where $a\in (0,1)$ and $b\in \mathbb{R}$. The directions say "fix a value for $a$ then find a proper value for $b$ such that you get the known value of temperature". I'm working on Matlab and it seems the best values are $a=b=0.5$ (just by inspection by looking the graphs after the filter). How can I exactly determine a good value for $b$?

Fixing $a\in(0,1)$ should ensure that the transfer function has a pole inside the unit disk and therefore be stable. In order to ensure the unity gain at zero Hertz you need to evaluate $H(z)$ at zero Hertz. In order to evaluate a discrete time transfer function at a frequency you can use $z=e^{j\,\omega\,T}$, with $\omega$ the frequency is radians per second and $T$ the sample time. So for zero Hertz/radians per second you get $z=1$. So evaluating $H(z)$ at this $z$ value gives
$$H(1) = \frac{b}{1 - a}.$$
This is only equal to one (unity) if $b=1-a$. So if you used $a=0.5$ then indeed it should be that $b=0.5$.
• Makes a lot of sense! But I have a doubt with the thing about the spectrum. Why do you say it is just a spike at $\omega=0$? I mean, how do you know that? Also: why do we have to ensure unity gain? – Miguel Duran Diaz Oct 28 '17 at 14:35
• @MiguelDuranDiaz When trying to find the frequency spectrum of a signal you basically try to fit $c_1\sin(\omega\,t)+c_2\cos(\omega\,t)$ for every frequency $\omega$, where $c_1$ and $c_2$ will tell you something about the magnitude and phase at that frequency. For example the magnitude would be $\sqrt{c_1^2+c_2^2}$. However it can be shown that when you try to do this onto a signal that is a constant, then $c_1=c_2=0\ \forall\ \omega\neq0$. But at $\omega=0$ we have $\cos(0\,t)=1$, so $c_2$ will become equal to that constant (and $c_1=0$). – fibonatic Oct 28 '17 at 16:12
• @MiguelDuranDiaz Unity gain is required because we want to get a better estimate of the constant. The filter should reduce the influence of the noise. But if the filter doesn't have unity gain at zero Hertz then you might not get a better estimate of the constant. Namely that constant will get multiplied by the gain at zero Hertz. This would be equivalent to looking at the average of $\alpha\,y[n]$, with $\alpha$ the gain at zero Hertz. This has the expected value of $26\,\alpha$ as the average. So from this we can conclude that $\alpha=1$ would be desired. – fibonatic Oct 28 '17 at 16:24