How to minimize a parameter in a differential equation
Show older comments
I have this MATLAB code for solving the heat equation using Explicit Euler Method
if true
% L = 1.;
T =1.;
maxk = 2500;
dt = T/maxk;
n = 50;
dx = L/n;
cond = 1/4; %%%%%%%%%%Conductivity parameter
b = 2.*cond*dt/(dx*dx);
for i = 1:n+1
x(i) =(i-1)*dx;
u(i,1) =sin(pi*x(i));
end;
for k=1:maxk+1
u(1,k) = 0.;
u(n+1,k) = 0.;
time(k) = (k-1)*dt;
end;
for k=1:maxk
for i=2:n;
u(i,k+1) =u(i,k) + 0.5*b*(u(i-1,k)+u(i+1,k)-2.*u(i,k));
end;
end;
end
I am given the actual solution and I am asked to interpolate the numerical solution data to match the actual data intervals. Then I have to minimize the square error function of the difference between the actual and the numerical data with respect to Conductivity (cond) using free-derivative optimization method such as Nelder-Mead method.
I know how to interpolate as well as minimize using these methods but with an objective function and variables.
In my case, the objective function is just data and it doesn't have the conductivity paramter. It is inside the numerical solution code.
How the minimization is done in this case?
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!