MATLAB: Iterate values of x through the difference between 2 functions equal to 40. the final x must make the equations equal to 40

loops

hi guys this is what i have so far. I am not sure how to make it test values of x until the function equals 40. Abs(F1-F2)=40
x=linspace(0,10,100);
F1=3*x+6;
F2=x.^2-log(x);
figure(2)
plot(x,F1,x,F2)
m=40;
w=abs(F1-F2);
if m=w

Best Answer

[~,idx]=min(abs(w-m))
out=w(idx)
Related Question