How can I integrate an equation that contains a time varying variable
Show older comments
I have a simple 1st oder differential equation I am solving. The function is as below along with my plot.m file.
To test it I intially used a constant value for T so I could plot it against an exact solution.
Now I want to input a matrix of T which varies with time i.e
t T
0.0 300.0
0.005 350.0
0.01 500.o
Can anyone suggest what I need to do to the T variable in the
K = 1e006 * exp (-5e003/T)
line.
Thanks in advance
.m
%%%%%%%%%%%%%%%%%%%%%%%%%%
function df = letsgo(t,f)
% Input constant temperature for Integration.
% T is variable.
T = 2000
K = 1e006 * exp (-5e003/T)
df = zeros(1,1);
df = -K * f;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
My plot file is plot.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[t,f] = ode45('letsgo',[0 0.01], 1.0);
plot(t,f);
xlabel('time');
ylabel('f(t)');
title('Plot');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!