Main
~~This homework assignment~~ involves fitting parameters in a dynamic model. In many cases, a linear first order differential equation can approximate the dynamic evolution of many systems. The unknown parameters for this system include the time constant (tau), gain (K), and sometimes dead-time (theta).

----

!!!! MATLAB and Python Solutions

An alternative approach to the sum of squared errors is to minimize an ''L'_1_'''-norm error to find the optimal values of K (gain) and tau (time constant).

* [[Attach:dynamic_solution.zip|Download MATLAB and Python Solutions for Dynamic Parameter Estimation]]

-> Attach:dynamic_solution_files.png

The MATLAB and Python plots produce trends that show the optimal solution with an ''L'_1_'''-norm objective function.

-> Attach:dynamic_solution_plot.png

The nonlinear confidence interval is shown by producing a contour plot of the SSE objective function with variations in the two parameters. The optimal solution is shown at the center of the plot and the objective function becomes worse (higher) away from the optimal solution.

-> Attach:dynamic_solution_contour.png

The confidence interval is determined with an F-test that specifies an upper limit to the deviation from the optimal solution. For many problems, this creates a multi-dimensional nonlinear confidence region. In the case of 2 parameters, the nonlinear confidence region is a 2-dimensional space.

## Dynamic Estimation

## Main.DynamicEstimation History

Hide minor edits - Show changes to output

Changed line 42 from:

The required Python packages are ~~[[Attach:python-2.7.3.msi | Python 2~~.~~7]], [[Attach:numpy-1.6.2.exe | Numpy 1.6.2]], [[Attach:matplotlib-1.2.0.exe | Matplotlib 1.2.0]], and [[Attach:scipy-0.11.0.exe | Scipy 0.11.0]]. The MATLAB and Python plots produce trends that show the optimal solution with an ~~''~~L~~'_1_'''-norm objective function.

to:

The required Python packages are Python, Numpy, Matplotlib, and Scipy. The MATLAB and Python plots produce trends that show the optimal solution with an ''l'_1_'''-norm objective function.

Changed lines 5-6 from:

to:

Dynamic estimation involves fitting parameters in a dynamic model. In many cases, a linear first order differential equation can approximate the dynamic evolution of many systems. The unknown parameters for this system include the time constant (tau), gain (K), and sometimes dead-time (theta).

Changed line 9 from:

For this ~~assignment~~, you can assume that the dead-time (theta) is zero and estimate only the time constant (tau) and gain (K). The following data set was generated in class from a voltage input (u) that changed the temperature (x) of a thermister.

to:

For this exercise, you can assume that the dead-time (theta) is zero and estimate only the time constant (tau) and gain (K). The following data set was generated in class from a voltage input (u) that changed the temperature (x) of a thermister.

Changed line 14 from:

Fit the dynamic data to a first order linear system by estimating ''tau'' (time constant) and ''K'' (gain). Determine the confidence intervals for the parameters (see [[http://youtu.be/rL7Mvl2-XIM|F-test video tutorial]]).

to:

Fit the dynamic data to a first order linear system by estimating ''tau'' (time constant) and ''K'' (gain). Determine the 95% and 99% confidence intervals for the parameters (see [[http://youtu.be/rL7Mvl2-XIM|F-test video tutorial]]).

Changed lines 50-51 from:

The confidence interval is determined with an F-test that specifies an upper limit to the deviation from the optimal solution~~.~~

to:

The confidence interval is determined with an F-test that specifies an upper limit to the deviation from the optimal solution

Changed line 54 from:

For many problems, this creates a multi-dimensional nonlinear confidence region. In the case of 2 parameters, the nonlinear confidence region is a 2-dimensional space.

to:

with p=2 (number of parameters), n=851 (number of measurements), theta=[K,tau] (parameters), theta'^*^' as the optimal parameters, SSE as the sum of squared errors, and the F statistic that has 3 arguments (alpha=confidence level, degrees of freedom 1, and degrees of freedom 2). For many problems, this creates a multi-dimensional nonlinear confidence region. In the case of 2 parameters, the nonlinear confidence region is a 2-dimensional space.

Changed lines 50-54 from:

The confidence interval is determined with an F-test that specifies an upper limit to the deviation from the optimal solution. For many problems, this creates a multi-dimensional nonlinear confidence region. In the case of 2 parameters, the nonlinear confidence region is a 2-dimensional space.

to:

The confidence interval is determined with an F-test that specifies an upper limit to the deviation from the optimal solution.

-> Attach:f-test_equation.gif

For many problems, this creates a multi-dimensional nonlinear confidence region. In the case of 2 parameters, the nonlinear confidence region is a 2-dimensional space.

-> Attach:f-test_equation.gif

For many problems, this creates a multi-dimensional nonlinear confidence region. In the case of 2 parameters, the nonlinear confidence region is a 2-dimensional space.

Changed line 42 from:

The MATLAB and Python plots produce trends that show the optimal solution with an ''L'_1_'''-norm objective function.

to:

The required Python packages are [[Attach:python-2.7.3.msi | Python 2.7]], [[Attach:numpy-1.6.2.exe | Numpy 1.6.2]], [[Attach:matplotlib-1.2.0.exe | Matplotlib 1.2.0]], and [[Attach:scipy-0.11.0.exe | Scipy 0.11.0]]. The MATLAB and Python plots produce trends that show the optimal solution with an ''L'_1_'''-norm objective function.

Changed lines 18-19 from:

!!!! Solution

to:

!!!! Excel Solution

Added lines 32-50:

----

!!!! MATLAB and Python Solutions

An alternative approach to the sum of squared errors is to minimize an ''L'_1_'''-norm error to find the optimal values of K (gain) and tau (time constant).

* [[Attach:dynamic_solution.zip|Download MATLAB and Python Solutions for Dynamic Parameter Estimation]]

-> Attach:dynamic_solution_files.png

The MATLAB and Python plots produce trends that show the optimal solution with an ''L'_1_'''-norm objective function.

-> Attach:dynamic_solution_plot.png

The nonlinear confidence interval is shown by producing a contour plot of the SSE objective function with variations in the two parameters. The optimal solution is shown at the center of the plot and the objective function becomes worse (higher) away from the optimal solution.

-> Attach:dynamic_solution_contour.png

The confidence interval is determined with an F-test that specifies an upper limit to the deviation from the optimal solution. For many problems, this creates a multi-dimensional nonlinear confidence region. In the case of 2 parameters, the nonlinear confidence region is a 2-dimensional space.

Changed line 22 from:

Attach:dynamic_discrete_eqn.gif

to:

-> Attach:dynamic_discrete_eqn.gif

Changed lines 20-24 from:

The dynamic model can be written in discrete form by specifying that the voltage is constant between sampling intervals. The discrete form of the equation accounts for non-zero initial conditions in temperature (~~t[~~0~~]~~) and voltage (~~v[~~0~~]~~). In this case, the voltage does start at zero, but this is not required.

~~-> ~~Attach:dynamic_discrete_eqn.gif

The above equation and the data are put into an Excel worksheet. The difference between the measured and predicted values are minimized to obtain the optimal parameters ''K'' (gain) and ''tau'' (time constant).

The above equation and the data are put into an Excel worksheet. The difference between the measured and predicted values are minimized to obtain the optimal parameters ''K'' (gain) and ''tau'' (time constant).

to:

The dynamic model can be written in discrete form by specifying that the voltage is constant between sampling intervals. The discrete form of the equation accounts for non-zero initial conditions in temperature (''x'_0_''') and voltage (''u'_0_'''). In this case, the voltage does start at zero, but this is not required.

Attach:dynamic_discrete_eqn.gif

In this equation, the subscripts denote the sampling intervals that are collected at a time interval of delta time = t'_k_'-t'_k-1_'. The above equation and the data are put into an Excel worksheet. The difference between the measured and predicted values are minimized to obtain the optimal parameters ''K'' (gain) and ''tau'' (time constant).

Attach:dynamic_discrete_eqn.gif

In this equation, the subscripts denote the sampling intervals that are collected at a time interval of delta time = t'_k_'-t'_k-1_'. The above equation and the data are put into an Excel worksheet. The difference between the measured and predicted values are minimized to obtain the optimal parameters ''K'' (gain) and ''tau'' (time constant).

Changed line 29 from:

The spreadsheet is ~~current~~ showing non-optimal values. To obtain the optimal values, use Excel Solver available from the Data toolbar. If the solver option does not appear, it can be added with the Add-In manager.

to:

The spreadsheet is currently showing non-optimal values. To obtain the optimal values, use Excel Solver available from the Data toolbar. If the solver option does not appear, it can be added with the Add-In manager.

Changed lines 14-15 from:

Fit the dynamic data to a first order linear system by estimating tau (time constant) and K (gain). Determine the confidence intervals for the parameters (see [[http://youtu.be/rL7Mvl2-XIM|F-test video tutorial]]).

to:

Fit the dynamic data to a first order linear system by estimating ''tau'' (time constant) and ''K'' (gain). Determine the confidence intervals for the parameters (see [[http://youtu.be/rL7Mvl2-XIM|F-test video tutorial]]).

----

!!!! Solution

The dynamic model can be written in discrete form by specifying that the voltage is constant between sampling intervals. The discrete form of the equation accounts for non-zero initial conditions in temperature (t[0]) and voltage (v[0]). In this case, the voltage does start at zero, but this is not required.

-> Attach:dynamic_discrete_eqn.gif

The above equation and the data are put into an Excel worksheet. The difference between the measured and predicted values are minimized to obtain the optimal parameters ''K'' (gain) and ''tau'' (time constant).

* [[Attach:dynamic_excel.zip|Download Excel Worksheet for Dynamic Parameter Estimation]]

-> Attach:dynamic_excel.png

The spreadsheet is current showing non-optimal values. To obtain the optimal values, use Excel Solver available from the Data toolbar. If the solver option does not appear, it can be added with the Add-In manager.

-> Attach:dynamic_solver.png

----

!!!! Solution

The dynamic model can be written in discrete form by specifying that the voltage is constant between sampling intervals. The discrete form of the equation accounts for non-zero initial conditions in temperature (t[0]) and voltage (v[0]). In this case, the voltage does start at zero, but this is not required.

-> Attach:dynamic_discrete_eqn.gif

The above equation and the data are put into an Excel worksheet. The difference between the measured and predicted values are minimized to obtain the optimal parameters ''K'' (gain) and ''tau'' (time constant).

* [[Attach:dynamic_excel.zip|Download Excel Worksheet for Dynamic Parameter Estimation]]

-> Attach:dynamic_excel.png

The spreadsheet is current showing non-optimal values. To obtain the optimal values, use Excel Solver available from the Data toolbar. If the solver option does not appear, it can be added with the Add-In manager.

-> Attach:dynamic_solver.png

Changed line 14 from:

Fit the dynamic data to a first order linear system by estimating tau (time constant) and K (gain). Determine the confidence intervals for the parameters.

to:

Fit the dynamic data to a first order linear system by estimating tau (time constant) and K (gain). Determine the confidence intervals for the parameters (see [[http://youtu.be/rL7Mvl2-XIM|F-test video tutorial]]).

Changed line 14 from:

Fit the dynamic data to a first order linear system by estimating tau (time constant) and K (gain).

to:

Fit the dynamic data to a first order linear system by estimating tau (time constant) and K (gain). Determine the confidence intervals for the parameters.

Changed line 11 from:

* [[Attach:dynamic_data.zip|Download Dynamic Data]]

to:

* [[Attach:dynamic_estimation_data.zip|Download Dynamic Data]]

Changed line 11 from:

* [[Attach:dynamic_data.~~csv~~|Download Dynamic Data]]

to:

* [[Attach:dynamic_data.zip|Download Dynamic Data]]

Added lines 1-41:

(:title Dynamic Estimation:)

(:keywords Dynamic Estimation, Lagrange Multiplier, Optimization, Constraint, Nonlinear Programming:)

(:description Homework on Dynamic Estimation with by Minimizing a Sum of Squared Errors.:)

This homework assignment involves fitting parameters in a dynamic model. In many cases, a linear first order differential equation can approximate the dynamic evolution of many systems. The unknown parameters for this system include the time constant (tau), gain (K), and sometimes dead-time (theta).

-> Attach:dynamic_equation.gif

For this assignment, you can assume that the dead-time (theta) is zero and estimate only the time constant (tau) and gain (K). The following data set was generated in class from a voltage input (u) that changed the temperature (x) of a thermister.

* [[Attach:dynamic_data.csv|Download Dynamic Data]]

-> Attach:dynamic_data.png

Fit the dynamic data to a first order linear system by estimating tau (time constant) and K (gain).

----

The difficulty of the last few assignments has been reduced to allow time for work on the [[Main/SolverProject|Final Project]]. Please use the additional time this week to develop the project and start the write-up.

----

Attach:group50.png This assignment can be completed in groups of two. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].

----

(:html:)

<div id="disqus_thread"></div>

<script type="text/javascript">

/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */

var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

/* * * DON'T EDIT BELOW THIS LINE * * */

(function() {

var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;

dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';

(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

})();

</script>

<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

(:htmlend:)

(:keywords Dynamic Estimation, Lagrange Multiplier, Optimization, Constraint, Nonlinear Programming:)

(:description Homework on Dynamic Estimation with by Minimizing a Sum of Squared Errors.:)

This homework assignment involves fitting parameters in a dynamic model. In many cases, a linear first order differential equation can approximate the dynamic evolution of many systems. The unknown parameters for this system include the time constant (tau), gain (K), and sometimes dead-time (theta).

-> Attach:dynamic_equation.gif

For this assignment, you can assume that the dead-time (theta) is zero and estimate only the time constant (tau) and gain (K). The following data set was generated in class from a voltage input (u) that changed the temperature (x) of a thermister.

* [[Attach:dynamic_data.csv|Download Dynamic Data]]

-> Attach:dynamic_data.png

Fit the dynamic data to a first order linear system by estimating tau (time constant) and K (gain).

----

The difficulty of the last few assignments has been reduced to allow time for work on the [[Main/SolverProject|Final Project]]. Please use the additional time this week to develop the project and start the write-up.

----

Attach:group50.png This assignment can be completed in groups of two. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].

----

(:html:)

<div id="disqus_thread"></div>

<script type="text/javascript">

/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */

var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

/* * * DON'T EDIT BELOW THIS LINE * * */

(function() {

var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;

dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';

(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

})();

</script>

<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

(:htmlend:)