Solving differential equation - where is my mistake in my code?
Show older comments

function HW_3_Exercise_11_ode_solver()
%Firstly define the given parameters
beta = 0.8; % Maximal expression rate
alpha =0.6; % Degredation rate
K = 0.25; % Activation coefficient
n = 4; % a constant
C0 = 0.1; % Initial concentration at time 0,
[tvals1,cvals1] = ode45(@protein_eqn,[0, 15],C0);
C1 = 0.2; % Another Initial concentration
[tvals2,cvals2] = ode45(@protein_eqn,[0, 15],C1);
figure3 = figure;
axes('Parent',figure3,'FontSize',12);
box('on');
hold('all');
plot(tvals1,cvals1);
hold on
plot(tvals2,cvals2);
title({'Solution to problem #5'},'FontSize',14);
xlabel({'{Time (sec)}'},'FontSize',14,'FontName','Times New Roman');
ylabel({'% Concentration (mols/m^3)'},'FontSize',14,'FontName','Times New Roman');
% Define the function
function dcdt = protein_eqn (C)
dcdt = beta*(C/K)^n/(1+(C/K)^n)- alpha*C;
end
end
But when I run, I obtain the error
Where is my mistake? I cannot handle it? Please le me know my mistake. Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differential Equations 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!