Hi Could anyone help me on how to use lpc (linear prediction coeff) for interpolation ? I have a vector where some elements(samples) are way off what is reasonable and wondered if I could use lpc to estimate replacements for those but I don't know how to incorporate the neighbouring (those before and after)samples to estimate the new ones. Matlab has a function called 'lpc' but I am a bit confused how to use that (more than a bit) Thanks in advance Kamran

# using lpc to interpolate

Kamran wrote:> Hi > > > Could anyone help me on how to use lpc (linear prediction coeff) > for interpolation ? I have a vector where some elements(samples) are way > off what is reasonable and wondered if I could use lpc > to estimate replacements for those but I don't know how > to incorporate the neighbouring (those before and after)samples > to estimate the new ones. Matlab has a function called 'lpc' > but I am a bit confused how to use that (more than a bit)Here is one possible way, assuming there are only one bad sample per burst: - Build a signal autocovariance matrix from only good data - Estimate the order of the AR predictor that bes fits the signal statistic, call the order P. - Use the P samples preceeding each bad sample, and use the forward prediction estimator to find a "good" value for the bad sample - Repeat for the P samples following a bad sample, using the backward estimator - Estimate the "bad" sample as the average between the forward and backward predictions. Apart from that, go have a chat with Sverre Holm, who I think still is with your university. Rune

Rune Allnor wrote:> > Kamran wrote: > >>Hi >> >> >>Could anyone help me on how to use lpc (linear prediction coeff) >>for interpolation ? I have a vector where some elements(samples) are way >>off what is reasonable and wondered if I could use lpc >>to estimate replacements for those but I don't know how >>to incorporate the neighbouring (those before and after)samples >>to estimate the new ones. Matlab has a function called 'lpc' >>but I am a bit confused how to use that (more than a bit) > > > Here is one possible way, assuming there are only one bad > sample per burst: > > - Build a signal autocovariance matrix from only good data > - Estimate the order of the AR predictor that bes fits the > signal statistic, call the order P. > - Use the P samples preceeding each bad sample, and use the > forward prediction estimator to find a "good" value for the > bad sample > - Repeat for the P samples following a bad sample, using the > backward estimator > - Estimate the "bad" sample as the average between the forward > and backward predictions. > > Apart from that, go have a chat with Sverre Holm, who I think > still is with your university. > > Rune >Thanks Rune for the answer. What I don't understand about matlab's 'lpc' is that it gives me the same number of samples which are the estimates of the existing samples and not the next sample (missing one), the one I am looking for! I have my own routine for linear prediction and I am trying to compare that with matlab's 'lpc'. Hilsen Kamran

Kamran wrote:> Rune Allnor wrote: > > > > Kamran wrote: > > > >>Hi > >> > >> > >>Could anyone help me on how to use lpc (linear prediction coeff) > >>for interpolation ? I have a vector where some elements(samples) are way > >>off what is reasonable and wondered if I could use lpc > >>to estimate replacements for those but I don't know how > >>to incorporate the neighbouring (those before and after)samples > >>to estimate the new ones. Matlab has a function called 'lpc' > >>but I am a bit confused how to use that (more than a bit) > > > > > > Here is one possible way, assuming there are only one bad > > sample per burst: > > > > - Build a signal autocovariance matrix from only good data > > - Estimate the order of the AR predictor that bes fits the > > signal statistic, call the order P. > > - Use the P samples preceeding each bad sample, and use the > > forward prediction estimator to find a "good" value for the > > bad sample > > - Repeat for the P samples following a bad sample, using the > > backward estimator > > - Estimate the "bad" sample as the average between the forward > > and backward predictions. > > > > Apart from that, go have a chat with Sverre Holm, who I think > > still is with your university. > > > > Rune > > > > Thanks Rune for the answer. > What I don't understand about matlab's 'lpc' is that > it gives me the same number of samples which are the > estimates of the existing samples and not the next sample > (missing one), the one I am looking for! > I have my own routine for linear prediction and I am trying > to compare that with matlab's 'lpc'.Eh... LPC computes the prediction coefficients from the available data, based on the estimated autocorrelation sequence. You ought to get the coefficients of the N'th order predictor by the call a=lpc(x,N); where x is the data vector. Once you have the prediction coefficients, you apply them in the usual way to the data. Rune

Rune Allnor wrote:> > Kamran wrote: > >>Rune Allnor wrote: >> >>>Kamran wrote: >>> >>> >>>>Hi >>>> >>>> >>>>Could anyone help me on how to use lpc (linear prediction coeff) >>>>for interpolation ? I have a vector where some elements(samples) are way >>>>off what is reasonable and wondered if I could use lpc >>>>to estimate replacements for those but I don't know how >>>>to incorporate the neighbouring (those before and after)samples >>>>to estimate the new ones. Matlab has a function called 'lpc' >>>>but I am a bit confused how to use that (more than a bit) >>> >>> >>>Here is one possible way, assuming there are only one bad >>>sample per burst: >>> >>>- Build a signal autocovariance matrix from only good data >>>- Estimate the order of the AR predictor that bes fits the >>> signal statistic, call the order P. >>>- Use the P samples preceeding each bad sample, and use the >>> forward prediction estimator to find a "good" value for the >>> bad sample >>>- Repeat for the P samples following a bad sample, using the >>> backward estimator >>>- Estimate the "bad" sample as the average between the forward >>> and backward predictions. >>> >>>Apart from that, go have a chat with Sverre Holm, who I think >>>still is with your university. >>> >>>Rune >>> >> >>Thanks Rune for the answer. >>What I don't understand about matlab's 'lpc' is that >>it gives me the same number of samples which are the >>estimates of the existing samples and not the next sample >>(missing one), the one I am looking for! >>I have my own routine for linear prediction and I am trying >>to compare that with matlab's 'lpc'. > > > Eh... LPC computes the prediction coefficients from the available > data, based on the estimated autocorrelation sequence. You ought to > get the coefficients of the N'th order predictor by the call > > a=lpc(x,N); > > where x is the data vector. Once you have the prediction coefficients, > you apply them in the usual way to the data. > > Rune >Thanks a lot Rune. I got it now. Kamran