Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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;
       Sow[efeld];
       Sow[J];
       ];
     ][[2, 1]]~Partition~2;
share|improve this question
1  
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

1 Answer 1

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

 
discard

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.