Implementation of a function



Hi,

I would like to ask a question about implementation of a function in
Matlab. Let me explain my question:

In my problem, it is necessary to define a fuction in the form:

f(t) = a*exp(bt)

in which a and b can be analytically expressed as a = a_1*s + a_2*n
and b = b_1*s +b_2*n where s, n are arrays of known integer values.
(For example, a = 1:3 and b = 1:5.)
We have f(a, b, t) = (a_1*s + a_2*n)*exp[(b_1*s +b_2*n)*t]. I want to
fit the function to some observed data so I have to minimize the sum
of square.

We'll take a mechanism as follow. Let's consider the trivial case,
where a and b are number themselves (not analytical expressions), it
is easy to define f(t) as:

func = @(x, theta) theta1*exp(theta2*t) (1)

and the sum of square is illustated in the following form:

ssfunc = @(theta, data) sum((data.ydata - func(data.xdata,
theta)).^2) (2)

Using

[thetaHat, ssmin] = fminsearch(ssfunc, initialValues, [],
data) (3)

it is possible to find the minimum value for ssfunc as well as the
corresponding parameters theta1 & theta2.

The question is: how can I use the same mechanism (1, 2, 3) to find
thetaHat when a, b are expressed in its full form. In this case,

thetaHat = [thetaHat1 thetaHat2 thetaHat3 thetaHat4] where
thetaHat1, 2 = a_1, 2 and thetaHat3, 4 = b_1, 2.

The question can be understood in other way as well, "how to implement
f(t) and use it for sum of square minimization?".

Any comment from you is greatly appreciated.
I am looking forward to seeing your replies,
Iaoh.
.



Relevant Pages

  • Implementation of a function
    ... fit the function to some observed data so I have to minimize the sum ... where a and b are number themselves (not analytical expressions), ... and the sum of square is illustated in the following form: ... it is possible to find the minimum value for ssfunc as well as the ...
    (comp.soft-sys.matlab)
  • Implementation of a function
    ... fit the function to some observed data so I have to minimize the sum ... where a and b are number themselves (not analytical expressions), ... and the sum of square is illustated in the following form: ... it is possible to find the minimum value for ssfunc as well as the ...
    (sci.stat.math)
  • every number has its own significance.....
    ... 18 is the only number that is twice the sum of its digits. ... 21 is the smallest number of distinct squares needed to tile a square. ... 26 is the only number to be directly between a square and a cube. ... 27 is the largest number that is the sum of the digits of its cube. ...
    (sci.crypt)
  • Re: 1-1/2+1/3-1/4+1/5-1/6+1/7
    ... this series can be made to sum to anything. ... However, the convergence is not absolute, so we can find ... containing both L and "Square" elements. ... Indeed this is indexed by a different ordinal (2 omega) of the same ...
    (sci.math)
  • Re: Biased and unbiased std dev
    ... unbiased estimate of by dividing by; taking the square root biases ... The reason for the bias is that when you take the average sum of squares ... subtracting out the variance of the sample mean itself (which will be ... deviations around it than any other value. ...
    (sci.stat.math)

Quantcast