# fsolve + fminbnd combination... Problem !

1 view (last 30 days)
Sergio Quesada on 5 Oct 2018
Commented: Torsten on 9 Oct 2018
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 CommentsShowHide 1 older comment
Sergio Quesada on 6 Oct 2018
Thank you for your answer, Matt. Yes, r is an scalar, and for each value of r, I want 10 different solutions G(r) - (texp-t) = 0, to be solve, each one for each value of texp. I call these solutions "rteor". I am trying this now:
rteor = @(r,t) fsolve(@(r) arrayfun (@(T) integral(F,1,r)-(T-t),texp), x0)
t = fminbnd(H(r,t),6e-3,t1-5e-5,options);

Matt J on 5 Oct 2018
Edited: Matt J on 5 Oct 2018
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
Torsten on 9 Oct 2018
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.