FSolve - no solution found, last step ineffective
29 views (last 30 days)
Show older comments
My function looks like this:
function F=Fn2(t)
global wn a g
F=(wn{1}^2)*a{1}(1,1)*sin(wn{1}*t)+(wn{2}^2)*a{2}(1,1)*sin(wn{2}*t)-g;
end
where wn, a, and g are defined in my main program. I call the function like this:
tlo=fsolve(@Fn2,1)
but fsolve can't seem to find a solution to the equation and is returning: "fsolve stopped because the last step was ineffective. However, the vector of function values is not near zero, as measured by the default value of the function tolerance."
"a" and "wn" are always real, and I've messed around with changing fsolve's x0 position. Any ideas why it's not working? Thanks in advance.
5 Comments
Accepted Answer
Matt J
on 28 Nov 2013
FSOLVE can do it, but it has a rather narrow radius of capture around the desired tlo, roughly between 0.55 and .79
>> Fn2=@(t) (wn{1}^2)*a{1}(1,1)*sin(wn{1}*t)+(wn{2}^2)*a{2}(1,1)*sin(wn{2}*t)-g;
>> [tlo,fval] = fsolve(Fn2,.6,optimset('Display','none'))
tlo =
0.7667
fval =
7.1054e-15
3 Comments
Matt J
on 28 Nov 2013
FZERO has a fair bit larger radius of capture, roughly between .4 and 1.01
>> [tlo,fval] = fzero(Fn2,1)
tlo =
0.7667
fval =
7.1054e-15
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!