What does this error mean?

10 views (last 30 days)
Shun Weng
Shun Weng on 2 Oct 2015
Commented: Image Analyst on 4 Oct 2022
What does "The function values at the interval endpoints must differ in sign" mean? What are the endpoints? And what sign?
  1 Comment
Jan
Jan on 2 Oct 2015
Please provide more information: What are you doing? Which function are you calling? Waht are the inputs?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 2 Oct 2015
When you use a routine to find zero crossings, you pass in a location which is the start of the interval to search over, and a location which is the end of the interval to search over. Those locations are called "endpoints". Many of the routines to find zero crossings rely upon the two ends of the interval (the endpoints) being different in sign -- either positive and negative or else negative and positive. The routines then proceed by predicting a point between the two endpoints and testing the sign of the function at the point, knowing that the zero crossing must always be between the two points that have different sign.
For example, if your function was x^2-10 and you asked to search between +2 and +5, then 2^2-10 is negative and 5^2-10 is positive and so the routine knows that the zero crossing must be somewhere between them. But if you had asked to search between -5 and +5 then (-5)^2-10 is positive and (+5)^2-10 is positive and the zero finding routine cannot immediately tell whether there is a zero crossing somewhere between the two or not.
  3 Comments
Mohammed Dagher
Mohammed Dagher on 4 Oct 2022
Hi Matlab_Team,
I have the same problem.
I have to calculate the Intensity of images (contain fringes), then based on their contrast draw a curve and fit it.
from the fitted Curve, i have to find the nearest value to 50%. Some measurements comes with get below 50% and then raise again.
and the point is [
x = Abstand;
y = percent_max;
xf=linspace(0,max(Abstand),3000);
yf=interp1(x,y,xf,'spline');
plot(x,y,'LineStyle','none','Color','k', 'MarkerSize',6 ,'Marker','square');
hold on
plot(xf,yf,'-r')
Distance50=fzero(@(xf)interp1(x,y,xf,'spline')-50,[min(Abstand) max(Abstand)])
]
Can you please give me another way to find a value from a fitted curve at Y-Axis?
Or a way to solve this issue.
thank you in advance and i appreciate your help
Image Analyst
Image Analyst on 4 Oct 2022
@Mohammed Dagher you'd be best off starting your own discussion thread and attach Abstand and percent_max after you read this:
save('answers.mat', 'Abstand', 'percent_max');
By the way, I'm not sure what you're planning with creating Distance50 and the call to fzero. You didn't put any comment for that line.
You can find indexes for plot values less than 50 with
logicalIndexes = yf < 50;
linearIndexes = find(yf < 50);

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!