Solving System Algebraic and Differential Equation

1 view (last 30 days)
Hello all,
I have a problem fitting the best values for parameters b(1), b(2), b(3) to the experimental data. For my problem I have a system of algebraic equations that are inserted on the differential equation.
I addition to obtaining the best parameters to fit the data, I also want to see the predicted x of each time point)
I was wondering if anyone could help me with this task? I can also provide more details and my code, and I would appreciate a more specific/detailed answer by an experienced user.
Thanks so much!

Accepted Answer

Abraham Boayue
Abraham Boayue on 28 May 2018
Edited: Abraham Boayue on 28 May 2018
Here is a code that may help you get started.
function First_oder_ode
% Verify that your equations are implemented correctly.
% Run these functions as a single m-file.
N = 1000;
T = 120;
t = 0 :T/(N-1):T;
ic = 1e-7; % Initial conditions Must be 4 numbers, try different values
[t,x]= ode45(@RHS, t,ic );
figure
plot(t ,real(x),'linewidth',2,'color','b')
a = title('x(t)');
set(a,'fontsize',14);
a = ylabel('y');
set(a,'Fontsize',14);
a = xlabel('t [0 120]');
set(a,'Fontsize',14);
grid
function dxdt= RHS(t,x)
% parameters
b = [0.0025 3600 1.5];
C1 = 2;
C2 = 4;
Ct = ( t / (C1+C2 *t ) );
% Algebraic and ODE functions
A = log10(1 + exp ( b(1)* (Ct -b(2))));
dxdt = - A * b(3)* (-x / A).^ (1 - 1 / b(3));

More Answers (0)

Community Treasure Hunt

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

Start Hunting!