fsolve + fminbnd combination... Problem !
古いコメントを表示
Good evening to everybody. My problem is the following:
I want to solve a non-linear equation G(r)-(t-texp)=0 for the variable r with the following complications:
- r is in the upper limit of a definite integral of the integrand F(x).
-"texp" is a 1x10 array experimental points.
- t, which is another variable, are the minimums of another function H defined itself by G, H[t, G(r)].
I am not sure about the combination of algorithms that I must use. I have tried this scheme:
x0=ones(1,10)
rteor=@(r,t) fsolve(integral(G(x),1,r)-(t-texp),x0);
t = fminbnd(@(r,t) H,lb,up);
, but it does not work. I am almost sure fsolve is not well written. I have tried to make combinations with arrayfun inside fsolve, but with no success. I think it is a problem of dimensions and/or declaring variables. Can anybody help me please?
Thanks !!!
2 件のコメント
So r is a scalar and t is a function of r through the equation
t(r) = argmin_z H(z,G(r) )
That means you have 10 equations in one unknown, r. How do you expect to satisfy 10 different equations with only 1 degree of freedom?
Or, do you mean you are looking for 10 different r(i), corresponding to each texp(i) separately?
Sergio Quesada
2018 年 10 月 6 日
編集済み: Sergio Quesada
2018 年 10 月 6 日
回答 (1 件)
This might be what you want.
G=@(r) integral( @F,1,r);
t=@(r) fminbnd(@(z) H(z,G(r)),lb,up);
for i=1:10
r_solution(i) = fzero(@(r) G(r)-(t(r)-texp(i)) , r0 );
end
11 件のコメント
Sergio Quesada
2018 年 10 月 6 日
編集済み: Sergio Quesada
2018 年 10 月 6 日
Sergio Quesada
2018 年 10 月 6 日
編集済み: Sergio Quesada
2018 年 10 月 6 日
Sergio Quesada
2018 年 10 月 8 日
編集済み: Sergio Quesada
2018 年 10 月 8 日
r_teor=@(i) fsolve(@(r)Int(r)-(t(i)-texp(i)), inpts(i));
But where is t(i) ?
Sergio Quesada
2018 年 10 月 8 日
Sergio Quesada
2018 年 10 月 8 日
You need to restate your problem (in equation form). In the beginning, you said that t was a function of r (not r_teor). Now, you've changed your mind and the thing you are trying to solve is very muddled.
In any case, you will not be able to use fsolve for this. Your functions is clearly non-differentiable.
Sergio Quesada
2018 年 10 月 9 日
編集済み: Sergio Quesada
2018 年 10 月 9 日
Torsten
2018 年 10 月 9 日
And you claim that
2 - The equation I have is not I(t), but I[r_teor(t)], where r_teor(t) is in the form t(r_teor), being "r_teor" in an upper integration limit.
is not muddled ? Nobody is able to understand what you write here.
カテゴリ
ヘルプ センター および File Exchange で File Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!