How would I input this equation into MATLAB for the curve fit?

3 views (last 30 days)
Tm(t)=(T0-T)e^(-t/tau)+T
It is the transient response of a thermometer equation.

Answers (1)

Star Strider
Star Strider on 29 Sep 2016
As an anonymous function:
Tm = @(t) (T0-T) .* exp(-t./tau) + T;
The ‘T’, ‘T0’, and ‘tau’ values must be assigned in your workspace before you define your ‘Tm’ function.
If you want to estimate the values of ‘T’, ‘T0’, and ‘tau’, parameterise it and then estimate the parameters. This will work in any curve-fitting function:
% % % MAPPING: b(1) = T0, b(2) = T, b(3) = tau
Tm = @(b,t) (b(1)-b(2)) .* exp(-t./b(3)) + b(2);
See the section on Anonymous Functions in Function Basics for details.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!