what is the fastest appproach to solve a system of non linear equations ?

조회 수: 2 (최근 30일)
hamza karim
hamza karim 2021년 10월 19일
편집: Matt J 2021년 10월 21일
Hi everyone,
My problem is the following:
i have a rectangular domain discritzed into 1000x100 (MxN) nodal points, where M and N are the total nodal points in the y and x direction respectively.
On each nodal point along the x direction (N=1 to 100) i obtain a non linear system of 1000 algebraic equations which i solve using the function fsolve. so in total for one experimental point i have 100 systems of 1000 equations each. This leads to a simulation time of approximately 15 minutes for just one experimental point.
The issue is that my ultimate goal is to use lsqnonlin to estimate a parameter in my coupled PDE problem by fitting the solution to a total of 75 experimental points. Knowing that just a single simulation of these experimental points would approximately take 19 hours , the fitting procedure will thus take even more time.
So my question is the follwing, is there another function other than fsolve that can be used ? or is there a numerical approach that can minimize my fitting time ?
  댓글 수: 1
Steven Lord
Steven Lord 2021년 10월 19일
Can you show how you're setting up your system of equations? Does the function that you're passing into fsolve perform calculations with symbolic variables inside and only substitute values into those equations to generate a numerical result immediately before it returns? If so consider performing the symbolic calculations once and using matlabFunction to generate a function file for fsolve to use that computes the answer solely numerically, no symbolic calculations involved?

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2021년 10월 19일
편집: Matt J 2021년 10월 19일
Seems like it would make sense to regard this as a system of 100K simultaneous equations and solve for the PDE parameter with lsqnonlin directly. That way you aren't solving 100 separate times. Also, you seem to imply that you are ultimately pursuing only 1 unknown PDE parameter, so perhaps it would be even better to use fminbnd as opposed to lsqnonlin.
  댓글 수: 3
hamza karim
hamza karim 2021년 10월 21일
So an update on the situation, i was able to reduce the computing time from 15 min per experimental point to 37 s by predefining the Jacobian in my objective function. In this case, it would take approximately 5 minutes for a single simulation of all experimental points.
I guess it is reasonable to assume that the fitting procedure would somewhere between 2 and 5 hours. This is reasonable in my case. However if you still have any idea do not hesitate !
Matt J
Matt J 2021년 10월 21일
편집: Matt J 2021년 10월 21일
Your follow-up comments haven't really changed my original advice. Since you have a model for the final curve that you're currently fitting, it shouldn't be necessary to solve the ODEs one at a time and post-fit. Instead, it should be possible to develop equations by generating the curve first, based on a hypothetical parameter guess, and then plugging the resulting curve into the ODEs to see if they're satisfied. This would eliminate ODE solving steps altogether.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by