Heat transfer problem using runge kutta 4 method. Error in function

function [ du ] = du( r,T ) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here dr=0.005; ri=0.05; ro=0.075; rm=0.62; r=(ri:dr:ro); T(1)=700; taui=4.9; tauo=5;
if r<rm; du=(taui./(dynamic_viscosity+density.*epsilonm)).*((rm.^2)-(r.^2)./((rm.^2)-(ri.^2)))*((ri./r));
else du=-(tauo./(dynamic_viscosity+density.*epsilonm).*((r.^2)-(rm.^2))./((ro.^2)-((rm.^2))*(ro./r)));
end
Error in du (line 14) du=(taui./(dynamic_viscosity+density.*epsilonm)).*((rm.^2)-(r.^2)./((rm.^2)-(ri.^2)))*((ri./r));
when i try to run it, an error appears that there is an undefined function 'r'.

댓글 수: 2

Chris C
Chris C 2014년 3월 12일
편집: Chris C 2014년 3월 12일
How are you calling this function? Are you using a built in ODE solver (i.e. ode45, etc.) or are you building your own RK4 method?
Maybe you can give a little more detailed explanation of your system (heat system). That would help me to disect your code and find out what's going on.
Richard,to separate code part of your question from other stuff,after copying the code,select it and use the provided button '{}Code'.

댓글을 달려면 로그인하십시오.

답변 (0개)

질문:

2014년 3월 12일

댓글:

2014년 3월 12일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by