Re: Cost function for a model instead of a function?




"Green Knight " <GreenKnight50@xxxxxxxxx> wrote in message
news:h8bvjr$2pu$1@xxxxxxxxxxxxxxxxxxxxx
Hello there and thanks for reading:

I've been using MATLAB for about one year, but do not have true knowledge
of what it is capable of. My question is regarding the availability of
any built-in functions to serve as a 'cost function' for my application.

I have a model that simulates the movement of a car on a road. The model
keeps track of the car's position (think like GPS coordinates) and then
after simulation, calculates measurements such as mean distance, maximum
drift left or right, mean velocity, drift area, etc. The simulated values
are then compared to ACTUAL car data obtained through physical
experiments. Both sets of data, the MATLAB simulated & actual real-world
data, are then passed through a T-Test to determine statistical likeness.
If all measurements (mean distance, maximum left drift, etc.) are a match,
then the model is accurate. If say, the model's 'mean velocity' fails the
T-Test (meaning it is 'off' and not accurate), however, I currently
manually adjust 1 of 25 different model parameters (raising or lowering
the value), re-run the simulation and observe the T-Test results for
similarities.

This method works, but takes a very long time, as adjusting one parameter
to fix, say, the 'mean velocity' mismatch may resolve that T-Test value,
but it may then offset another value, say 'left drift' to a T-Test
mismatch. &#8230;so I then adjust another parameter, but then three
different mismatches result and etc. etc. This often becomes a vicious
'fixing the fix' cycle, but eventually, I get all of the parameters
tweaked to result in a successful model.


QUESTION: Is there a 'cost function' available in MATLAB to help me
automatically solve for this model's parameters? I have been exploring
different solvers in the Optimization Toolbox, but these seem to require a
straight-forward FUNCTION that I cannot provide, as my equation in
question is rather a model instead.

The Optimization Toolbox solvers do not require you to be able to write down
an explicit equation for the quantity you want to optimize; as long as you
can write a function that accepts some parameters, performs some
calculations, and returns the objective value ('cost') that you're trying to
optimize, it can accept that function. [Depending on how well-behaved your
function is, the optimization problem may be easy or difficult to solve. If
your objective function "value" is rand(size(theinput)), for instance ...
then you're going to have lots of trouble.] Take a look at this example in
the documentation that doesn't have an explicit function to solve, but
instead uses a Simulink simulation to calculate the value of the "function"
to be optimized.

http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/brn4noo.html

If your model is a Simulink model, you might also want to look at the
Simulink Design Optimization product, as suggested by the note that's around
the middle of the above page.

http://www.mathworks.com/access/helpdesk/help/toolbox/sldo/ug/ug_intropage.html

--
Steve Lord
slord@xxxxxxxxxxxxx
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


.



Relevant Pages

  • Re: Matlab Vectorisation Speed - How is it done in c++?
    ... code I have is testing the vector math capabilities and how fast they ... How does matlab do it? ... Memory access is terribly slow, ... Also remember Hoare's statement about optimization, ...
    (comp.soft-sys.matlab)
  • Re: MC-CDMA
    ... I am simulating MC-CDMA using Matlab. ... returned when I ran the simulation: ... % Calling of function for code matrix ... % Save BER for different SNR ...
    (comp.soft-sys.matlab)
  • Re: Matlab Vectorisation Speed - How is it done in c++?
    ... Beating the performance of vectorized Matlab code is very ... Matlab makes calls to optimized C and Fortran libraries ... Use optimization level 3 on numerical code and level 2 on non- ...
    (comp.soft-sys.matlab)
  • MC-CDMA simulation using Matlab
    ... I am simulating MC-CDMA using Matlab. ... returned when I ran the simulation: ... % Calling of function for code matrix ... % Taking FFT of the received signal ...
    (comp.dsp)
  • MC-CDMA simulation using Matlab
    ... I am simulating MC-CDMA using Matlab. ... returned when I ran the simulation: ... % Calling of function for code matrix ... % Taking FFT of the received signal ...
    (comp.soft-sys.matlab)

Loading