360 likes | 523 Views
Environmental Data Analysis with MatLab. Lecture 13: Filter Theory. SYLLABUS.
E N D
Environmental Data Analysis with MatLab Lecture 13: • Filter Theory
SYLLABUS Lecture 01 Using MatLabLecture 02 Looking At DataLecture 03Probability and Measurement ErrorLecture 04 Multivariate DistributionsLecture 05Linear ModelsLecture 06 The Principle of Least SquaresLecture 07 Prior InformationLecture 08 Solving Generalized Least Squares ProblemsLecture 09 Fourier SeriesLecture 10 Complex Fourier SeriesLecture 11 Lessons Learned from the Fourier Transform Lecture 12 Power Spectral DensityLecture 13 Filter Theory Lecture 14 Applications of Filters Lecture 15 Factor Analysis Lecture 16 Orthogonal functions Lecture 17 Covariance and AutocorrelationLecture 18 Cross-correlationLecture 19 Smoothing, Correlation and SpectraLecture 20 Coherence; Tapering and Spectral Analysis Lecture 21 InterpolationLecture 22 Hypothesis testing Lecture 23 Hypothesis Testing continued; F-TestsLecture 24 Confidence Limits of Spectra, Bootstraps
purpose of the lecture develop the Linear Filter as a way to describe the way past events influence present-time observations
sometimes, no past history is needed Thermometer measuring temperature θ(t) Flame with time-varying heat h(t) Flame instantaneously heats the thermometer Thermometer retains no heat θ(t) h(t)
this idea described as a linear model θ1= g 1 h 1 . . . θ10= g 1 h 10 θ11= g 1 h11 θ12= g 1 h 12 . . . θN= g 1 h N where g 1 is a constant
But sometimes,past history is needed Thermometer measuring temperature θ(t) Steel plate Flame with time-varying heat h(t) Heats takes time to seep through plate Plate retains heat θ(t=t’) history of h(t) for time t<t’
But sometimes,past history is needed Thermometer measuring temperature q(t) Steel plate “causal”: only past effects present (not future) Flame with time-varying heat h(t) Heats takes time to seep through plate Plate retains heat q(t=t’) history of h(t) for time t<t’
this idea described as a linear model . . . θ10= g 1 h 10 + g 2 h 9 + g 3 h 8 + g 4 h 7 + … θ11= g 1 h 11 + g 2 h 10 + g 3 h 9 + g 4 h 8 + … θ12= g 1 h 12 + g 2 h 11 + g 3 h 10 + g 4 h 9 + … . . . where g 1, g 2, g 3, … are constants called a “filter”
Special case: temperature depends only on the time elapsed since the flame was turned on, and not on the experiment as performed on Monday or Wednesday same shape • q(t) • q(t) experiment is “time-shift invariant”
this idea described as a linear model . . . θ10= g 1 h 10 + g 2 h 9 + g 3 h 8 + g 4 h 7 + … θ11= g 1 h 11 + g 2 h 10 + g 3 h 9 + g 4 h 8 + … θ12= g 1 h 12 + g 2 h 11 + g 3 h 10 + g 4 h 9 + … . . . where g 1, g 2, g 3, … are constants called a filter coefficients all the same … filter is time-shift invariant …
this idea written as a summation output input filter “convolution”, not multiplication
this idea written as matrix equation filter output input
we’ve heard the word “convolution” beforein Lecture 11it’s the name of this integral
but the integral can be approximated as the summation we’ve just seen
convolutions can be written two ways . . . θ10= g 1 h 10 + g 2 h 9 + g 3 h 8 + g 4 h 7 + … θ11= g 1 h 11 + g 2 h 10 + g 3 h 9 + g 4 h 8 + … θ12= g 1 h 12 + g 2 h 11 + g 3 h 10 + g 4 h 9 + … . . . g inside matrix h inside matrix
implying that the convolution operation is symmetricg*h = h*g
meaning of the filter gsuppose the input is a spikeh = [1, 0, 0, 0 … 0]Tthen the output is the filter output input filter
so the filter represents the“impulse response”of the experiment
A) Input is spike spike B) Output is impulse response q(t), K time , t, after impulse 0 h(t), W time , t, after impulse 0
A) spike of amplitude, h(t0) h(t), W time, t t0 B) h(t0)g(t-t0) q(t). K time, t t0
example: heat-generating layer z-axis observation point soil z z=0 heat-generating layer soil
known impulse response based on known physics of heat transfer
known impulse response distance from center of layer soil density 1500 kg/m3 soil heat capacity, 800 J/kg-K soil thermal diffusivity. 1.25×10-6 m2/s
A) time t, days time t, days Dt g(t) B) time t, days htrue(t), W/m2 C) q true(t), K
The Method solve using least-squares … well, use damped least square, just in case
A) q obs(t), K B) time t, days htrue(t), W/m2 time t, days C) hest(t) ), W/m2 time t, days
noise in data … A) q obs(t), K B) time t, days htrue(t), W/m2 time t, days C) hest(t) ), W/m2 … is amplified time t, days
Try addingprior information of smoothness(minimize second derivative)
A) q obs(t), K time t, days B) htrue(t), W/m2 time t, days C) hest(t) ), W/m2 much less noise time t, days
you should avoid constructing the matrix G = because it contains so many redundant elements
Tip #1use the conv() function to calculate the convolution q = g * hnot the matrix multiplication q=Gh tmp = conv(g, h); q=tmp(1:N); note that we truncate the output of conv(), so that is has the same length, N, as the input time series
Tip #2use the bicg() solver, together with the function filterrfun() to solve Fq=h by generalized least squares not matrix division hest=(FTF)\(FTq) it implements the matrix multiplications, GT(Gv), using the timeseriesg, and does not ever construct G filterrfun() is described in the text