Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: complex results using ODE45
Replies: 3   Last Post: Oct 22, 2013 2:25 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 3
Registered: 10/15/13
complex results using ODE45
Posted: Oct 15, 2013 1:53 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have the two m files given below. "a" and "T" are returned as complex with the coefficient of the complex part being zero (the real part gives the correct answer and hence the plot is fine) . Also dadT is becoming complex.

Why are values becoming complex?

Please help.

%this is in file alpha.m
function dadT = alpha(T,a)
b = 20
l= 50.1
ner = -36108.73
dadT = (k/b)*(exp(ner/T)) *((1-a)^n

%this is in file alpha_ode45.m
T0 = 0.00255
Tspan = [653.25,773]
[T,a] = ode45(@alpha,Tspan,T0);

% Print display in command window
disp('Solution, T and alpha')
format short
[T a]

% plot a vs T
axis([600 800 0 1])

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.