Hi,
is it possible to make an offset with fzero?
I have a function where I found the root with fzero. Now I want to use the same function but with an offset and let fzero compute the root of the function + offset.
Is this possible somehow?
Thank you for your help.

댓글 수: 1

Torsten
Torsten 2016년 1월 25일
Define a new function to be your old function plus the offset and call fzero again with this new function.
Best wishes
Torsten.

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

 채택된 답변

Stephen23
Stephen23 2016년 1월 25일
편집: Stephen23 2016년 1월 25일

0 개 추천

>> fun = @(x) x^2;
>> ofs = 3;
>> z = fzero(@(x)fun(x)-ofs,1)
z = 1.7321
and confirm that the function value is (almost) zero:
>> fun(z)-ofs
ans = -3.9968e-015
>> fun(z)
ans = 3.0000

댓글 수: 1

Simon Kreibich
Simon Kreibich 2016년 1월 25일
Oh, I thought I need to add the offset via an option.
Thank you, I solved my problem! Just that simple..

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

질문:

2016년 1월 25일

댓글:

2016년 1월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by