MATLAB Question - Optimization

Hello,

I am an ME STudent currently trying to solve a project with MATLAB.

First of all let me introduce the problem. I just solved a Differential Equation that gives me a vector of Temperatures. As inputs I had a vector of power, air temperature and thermal resistance.

So out of this code I got a calculated temperatur.

I also did measurements on an engine and I got a vector of temperature that I will call measured temperatures.

Now I want to minimize the error between the measured temperatur and the calculated temperature with MATLAB in order to find the best suited Thermal resistance at each point.

Here is my code...it never stops thats the problem

function rest = versuch_optim_2(x,temp,t,y1,f,g,ft,gt)

rest = 0;

f = interp1(ft,f,t,
'linear','extrap')'; % Interpolate the data set (ft,f) at time t (linear Method), extrapolate if t is outside of ft
g = interp1(gt,g,t,'linear','extrap')'; % Interpolate the data set (gt,g) at time t (linear Method), extrapolate if t is outside of gt



for i = 1:length(t)

dydt = (f(i)/(800*480) - ((temp(i)-g(i))./(x * 800 *480))) - y1(i);
% Evalute ODE at time t

rest = rest + dydt(1).^2;

end

________________________________________________________

and I use the following script line to call my code...does anyone know how to solve this...and am I posting this in the wrong place?

[x val]= fminsearch(@(x) versuch_optim_2(x,temp,t,y1,f,g,ft,gt), [1;(1:length(t))'],optimset('MaxFunEvals',10000,'MaxIter',10000))

Thank you

Edouard

Replies

You are reading an archived discussion.

Related Posts

hey guys, i have just bought a standard parallax servo motor. this motor has the same properties as futaba motors. the problem is when i apply the PWM signal to...
HI! Hope to have new friends here!
Windows only: Microsoft is pushing out Service Pack 2 for Office 2007, promising significant performance improvements and support for the OpenDocument format, among other things. Photo by Sunfox.... More...
i have to build an automatic sequential with 74613 counter and 32x4 Prom memory which has the evolution of the following states (shown in the figure attched to this message)....
Microsoft just pushed out Office 2007 Service Pack 2 this morning, but that doesn't meant they're not already hard at work on Office 2010, the next version of the popular...