Search code examples
matlabgraphfunction-handle

Graphing the difference of two handle-functions in matlab


I have two handle-functions, their graphs are very close to each other, I can see this by plotting both functions.

f = @(x1);
ff = @(x2);
fplot(f, [0 1],'r')
hold on
fplot(ff, [0 1],'b')
hold on

I would like to have another graph where I take the difference between f-ff

fplot((f-ff), [0 1])

how can I do this in matlab? And how can I find the:

max(abs(f-ff))

when both are handle-functions?
Thanks in advance!

PS. Just let me know if I should add more info about f and ff.


Solution

  • Try this:

    fplot(@(x) f(x) - ff(x), [0 1])