Group Abstract Group Abstract

Message Boards Message Boards

1
|
9.7K Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

How to subtract interpolating functions

Posted 12 years ago
POSTED BY: Charles Rackson
2 Replies

Hi,

does this work for you?

(*Generate data*)
x = RandomReal[1, {100}]; y = RandomReal[1, {100}];

(*Interpolate*)
f = Interpolation[x]; g = Interpolation[y];

(*Define difference function*)
h = f[#] - g[#] &

(*Evaluate h*)
h[5]
(*Out:= -0.193709*)

(*Plot h*)

Plot[h[x],{x,1,100}]

enter image description here

If you are careful about it, you can even differentiate it (I used InterpolationOrder-> 2 for this):

Plot[h'[b], {b, 1, 100}]

enter image description here

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 12 years ago

Yes! That does it!

nudifference = nu1[#1, #2] - nu2[#1, #2] &

worked for me.

Thanks a lot, Marco!

POSTED BY: Charles Rackson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard