Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem and it seems to be connected to an Interpolating function inside of an NDSolve command. The resistivity[x] function inside the NDSolve command is an interpolation of measurement data. The code works fine with an ordinary function instead of the interpolating function. When I run the code, it does not give an error, but no results are displayed either. Does anybody know what the problem is?

The code is:

xydataplot = Reap[
     For[i = 1, i <= n, i++,
       J = i j;
       s = 
       NDSolve[{y'[x] == (resistivity[y[x]]  J^2)/nC 
        - alpha/nC (-T + y[x]), y[0] == T}, y, {x, 0, t}];
       Te = y[t] /. s;
       resis2 = resistivity[Te];
       efeld = J resis2;
     ][[2, 1]]~Partition~2;
share|improve this question
Can you please fix the code you have used in your question? It should be a minimal example which works and shows the issue you are experiencing. – halirutan Aug 4 '13 at 21:28

Without seeing the rest of your code, one can only guess:

Try to redefine your resistivity functions as

resistivity[in_?NumericQ] := Evaluate[ListInterpolation[yourData]];

and see if that fixes the problem.

share|improve this answer
Hi, thanks for the help. The problem was apparently, that the Te output was a list with one entry instead of a single value. Just evaluating First[Te] made the code work. But thank you very much for your idea! – Florian Aug 5 '13 at 18:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.