How to use fnzeros to find the zeros of a function?
Show older comments
For example I have y=sin(x*5)+sin(x*2) and I need to find where y=0 between x=-10 and x=+10
Accepted Answer
More Answers (1)
Looks like you're meant to form a spline approximation to y=sin(x*5)+sin(x*2) using spmak and then apply fnzeros to get the zeros. You will probably want to use a small knot spacing and test agreement with the original y(x) via some plots.
Theoretically, it's not a bulletproof way of getting the zeros. A bulletproof method can't rely exclusively on numerical solvers like fzero or fnzero. It would require some prior analysis determine the minimal spacing between solutions, but as a homework exercise, I guess your instructor doesn't care.
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!