How to calculate the maximum distance between two functions
Show older comments
Hello guys i have a test on matlab coming up in the university , one of the exercises is probably going to be to calculate the maxium distance between two functions.
ex.
f1=cos(x) f2=sin(x) x=[0,4pi]
find the x for which the distance between f1 and f2 is maximum
Answers (1)
x = fminbnd(@(x)-(sin(x)-cos(x))^2,0,4*pi)
distance = abs(sin(x)-cos(x))
Categories
Find more on MATLAB 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!