Path: news.mathworks.com!not-for-mail
From: "Markthomas " <cutonem@clarkson.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Problem with using ODE solvers
Date: Sat, 7 Nov 2009 19:10:04 +0000 (UTC)
Organization: University of Tennessee
Lines: 58
Message-ID: <hd4gmc$amd$1@fred.mathworks.com>
Reply-To: "Markthomas " <cutonem@clarkson.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257621004 10957 172.30.248.37 (7 Nov 2009 19:10:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 7 Nov 2009 19:10:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1794533
Xref: news.mathworks.com comp.soft-sys.matlab:583254


I am trying to run an ODE case usin ode45... the scripts are seen below:
---------------------------------------------code 1------------------------------------------------------------------
function varargout = odefile_V2(t,T,flag,tau,ET,R1,rho1,L1,C1,R3,R2,rho2,L2,C2,rho3,L3,C3)

switch flag
    case ''
        varargout{1} = f(t,T,tau,ET,R1,rho1,L1,C1,R3,R2,rho2,L2,C2,rho3,L3,C3);
    case 'init'
        [varargout{1:3}] = init(tau,ET,R1,rho1,L1,C1,R3,R2,rho2,L2,C2,rho3,L3,C3);
end

%--------------------------------------------------------------------------
function dydt = f(t,T,tau,ET,R1,rho1,L1,C1,R3,R2,rho2,L2,C2,rho3,L3,C3)

dydt(1) = (-(ET*(T(1)^4-(1200*(1-exp(-t/tau)))^4)+(R1*ET*(T(1)^4-(1200*(1-exp(-t/tau)))^4)+T(1)-T2(t))/R2)/rho1/L1/C1+4*ET*R1*(1200*(1-exp(-t/tau)))^3*((1200/tau)*exp(-t/tau)))/(4*ET*R1*T(1)^3+1);
dydt(2) = (R3*ET*R1*T(1)^4+R3*T(1)+(-R3-R2)*T(2)-R3*ET*R1*(1200*(1-exp(-t/tau)))^4+R2*T(3))/R2/R3/rho2/L2/C2;
dydt(3) = (T(2)-T(3))/R3/rho3/L3/C3;

function [tspan,y0,options] = init(tau,ET,R1,rho1,L1,C1,R3,R2,rho2,L2,C2,rho3,L3,C3)
tspan = [0; 100];
y0 = [300; 300; 300];
options = [];
---------------------------------------------code 2------------------------------------------------------------------
clear; clc; close all
% Material @ Node 0
T0_0 = 300;
% Material @ Node 1
T1_0 = 300;
K1 = 60;
rho1 = 8000;
C1 = 440;
L1 = .07;
% Material @ Node 2
T2_0 = 300;
K2 = 1.4;
rho2 = 1300;
C2 = 1500;
L2 = .04;
% Material @ Node 2
T3_0 = 300;
K3 = 50;
rho3 = 7500;
C3 = 400;
L3 = .02;
%Resistances
R1 = L1/(2*K1);
R2 = R1 + (L2/(2*K2));
R3 = (L2/(2*K2)) + (L3/(2*K3));
% Other Constants
ET = 4e-8;
tau = 50;

[t,T]=ode45('odefile_V2',tau,ET,R1,rho1,L1,C1,R3,R2,rho2,L2,C2,rho3,L3,C3);
------------------------------------------------------------------------------------------------------------------------
i keep getting errors and was hoping somebody was able to figure out what is going wrong.  I have rewritten the code several times and can't seem to get it to work... any help would be great! 

Thanks!
MT