필터 지우기
필터 지우기

No solution found using fsolve, what should I do?

조회 수: 3 (최근 30일)
Tmat
Tmat 2022년 11월 3일
댓글: Tmat 2022년 11월 10일
I'm trying to solve a nonlinear system with six equations and six unknowns (Basically it is trying to find the fixed point of a mapping from to ).
I wrote the following small experiment:
tempx=1;
p0=0.5*ones(1,6);
fsub=@(p)ComputeCCP(tempx,p);
[trueccp,fv,ext]=fsolve(fsub,p0);
It takes a long time to run this code, and in the end, it returns "No solution found". The function I feed into fsolve is called fsub, and it is a function of p. It is constructed using a function called ComputeCCP when its first parameter tempx is fixed at 1. I attached ComputeCCP in this question. It is slow to evaluate because I used 1 million simulations inside this function to compute double integrals (which gives probabilities) with high precision.
Why fsolve is not working here? What shall I do to find a solution to this system? Thanks in advance!

채택된 답변

John D'Errico
John D'Errico 2022년 11월 3일
편집: John D'Errico 2022년 11월 3일
A simple rule is fsolve assumes the function you feed it is well behaved. That means things like continuity. Differentiable. At the very least, it means that if you were to evaluate the function at the same set of values twice in a row, it would generate exactly the same result.
format long g
fsub(.5*ones(1,6))
ans =
Columns 1 through 3
0.096333 0.302968 0.30198
Columns 4 through 6
0.10278 0.319573 0.318503
fsub(.5*ones(1,6))
ans =
Columns 1 through 3
0.096683 0.30191 0.301975
Columns 4 through 6
0.102587 0.319008 0.318855
Do you see anything interesting there? That when evaluated at exactly the same point twice in a row, your function is not even consistent, returning the same result. That means continuity and especially differentiability are completely out of the question.
If I look at your code:
z11=normrnd(0,3);
z12=normrnd(0,3);
z21=normrnd(0,3);
z22=normrnd(0,3);
e11=normrnd(0,3);
e12=normrnd(0,3);
e21=normrnd(0,3);
e22=normrnd(0,3);
it appears to be a simulation of some sort. Is that going to produce the well-defined function I said fsolve REQUIRES? No.
I'm sorry. It does not matter how badly you want to use fsolve, you cannot do so.
  댓글 수: 11
Torsten
Torsten 2022년 11월 5일
편집: Torsten 2022년 11월 6일
Imagine you have an ignorant audience and you are to explain your mathematical problem. Do you think the audience would understand what you are talking about ? Or even to help you with your problem ?
Tmat
Tmat 2022년 11월 10일
@Torsten Hi Torsten, sorry for the delayed response and thanks for your help. I solved my problem mentioned in this question by passing simulated values as parameters with extremely large simulation sample size. The solutions are also verified.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by