modeling a kinetic reaction network with changing concentration

Hello All,
I'm trying to model a kinetic reaction network with a changing initial antibody concentration step. I also want to track the changing concentration of the antibody during the reaction itself.
I'm getting an error (see below) but I'm not sure how to solve it.
Error:
Unable to perform assignment because the left and right sides have a different number of elements.
Error in mazorbsabs_competition (line 60)
x(1) = Ab_0;
function bsabs_competition
close all;
clear all
tic
k_on_1CD70 = 1e5; %M-1s-1 on rate
k_d_1CD70 = 25e-9;
k_off_1CD70 = k_d_1CD70*k_on_1CD70
k_on_1CD4 = 1e5; %M-1s-1 on
k_d_1CD4 = 70e-9;
k_off_1CD4 = k_d_1CD4*k_on_1CD4
k_off_2CD70 = k_off_1CD70;
k_on_2CD70=2e6*k_on_1CD70;
kd_2p= k_off_2CD70/k_on_2CD70;
k_off_2CD4 = k_off_1CD4;
k_on_2CD4=2e6*k_on_1CD4;
kd_2c= k_off_2CD4/k_on_2CD4;
receptor_count_CD70 = 5.2e4;
number_unbound_CD70 = receptor_count_CD70;
CD70_0= number_unbound_CD70;
receptor_count_CD4 =4.6e4;
number_unbound_CD4 = receptor_count_CD4;
Cd4_0= number_unbound_CD4;
Ab_initial_conc = logspace(-11,-5,60);
free_Ab=Ab_initial_conc;
Ab_0=free_Ab;
time_at_measurement = 1; % hrs, length of simulation
%Common parameters changed are above this line
%______________________________________________________________________________________________________________
eqtime = [0, time_at_measurement*3600];
options = odeset('Maxstep',15,'RelTol',[1e-15],'AbsTol',[1e-15]);
x=zeros(6,1); % 6 species
%initialvalues:
x(1) = Ab_0; % tracking antibody
x(2) = CD70_0; % CD70 receptors
x(3) = Cd4_0; % CD4 receptors
x(4) = 0; % monovalent bound CD70
x(5) = 0; % monovalent bound CD4
x(6) = 0; % Crosslinked antibodies
for k = 1:numel(Ab_0) % vector space which makes the size the size of the changing variable
currentAb = Ab_0(k); % current is a name of a new varialbe name to calculate psy and P
[T,X] = ode15s(@(t,x)odesystem(t,x,currentAb), eqtime,x, options); % insert current name
free_ab= X(end,1);
free_cd70 = X(end,2);
free_cd4 = X(end,3);
monovalent_cd70 = X(end,4);
monovalent_cd4 = X(end,5);
crosslinked = X(end,6);
blocked = (receptor_count_CD70+receptor_count_CD4-X(end,1)-X(end,2))./(receptor_count_CD70+receptor_count_CD4);
ab(k)=free_ab;
pd1(k) = free_cd70;
cd(k) = free_cd4;
mpd (k) = monovalent_cd70;
mcd(k) = monovalent_cd4;
xl (k) = crosslinked;
end;
function xdot = odesystem(t,x,Ab_0)
xdot =[-k_on_1CD4*x(1)*x(3)+k_off_1CD70*x(4)-k_on_1CD70*x(1)*x(2)+k_off_1CD4*x(5);...
-k_on_1CD70*x(1)*x(2) + k_off_1CD70*x(4) - k_on_2CD70*x(2)*x(5) + k_off_1CD70*x(6);...
-k_on_1CD4*x(1)*x(3)+k_off_1CD4*x(5)-k_on_2CD4*x(3)*x(4)+k_off_1CD4*x(6);...
k_on_1CD70*x(1)*x(2)-k_off_1CD70*x(4)-k_on_2CD4*x(3)*x(4)+k_off_1CD4*x(6);...
k_on_1CD4*x(1)*x(3)-k_off_1CD4*x(5)-k_on_2CD70*x(2)*x(5)+k_off_1CD70*x(6);...
k_on_2CD4*x(3)*x(4)+k_on_2CD70*x(2)*x(5)-k_off_1CD4*x(6)-k_off_1CD70*x(6)];
end
free_ab= X(:,1);
free_cd70 = X(:,2);
free_cd4 = X(:,3);
monovalent_cd70 = X(:,4);
monovalent_cd4 = X(:,5);
crosslinked = X(:,6);
blocked = (receptor_count_CD70+receptor_count_CD4-X(:,1)-X(:,2))./(receptor_count_CD70+receptor_count_CD4);
Aba_conc = num2str(Ab_initial_conc);
graph_title = ['Ab1 conc=' Aba_conc];
%plotting
scrsz = get(0,'ScreenSize');
figure('Position',[0 scrsz(4) scrsz(3)/1.5 scrsz(4)/3]); %positioning plot on screen
subplot(1,2,1);
plot(T/3600,free_cd70,T/3600,free_cd4,T/3600,monovalent_cd70,T/3600,monovalent_cd4,T/3600,crosslinked)
xlabel('Time')
ylabel('Receptors with antibody')
legend('Free PD 1','Free CD 137 ','PD1-Ab (mono)','CD137-Ab (mono)','Crosslinked')
title('species concentration')
figure
semilogx(Ab_initial_conc,pd1);
xlabel('Concentration')
ylabel(' Receptors with antibody')
%legend('Test')
title('Free CD70')
hold on
legend('numerical result')
hold off
figure
semilogx(Ab_initial_conc,cd);
xlabel('Concentration')
ylabel('Receptors with antibody')
%legend('Test')
title('Free CD4')
hold on
legend('numerical result')
hold off
figure
semilogx(Ab_initial_conc,mpd);
xlabel('Concentration')
ylabel('Receptors with antibody')
%legend('Test')
title('Mono Bound CD70')
hold on
hold on
legend('numerical result')
hold off
figure
semilogx(Ab_initial_conc,mcd);
xlabel('Concentration')
ylabel('Receptors with antibody')
%legend('Test')
title('Mono Bound CD4')
hold on
legend('numerical result')
hold off
figure
semilogx(Ab_initial_conc,xl);
xlabel('Concentration')
ylabel('Receptors with antibody')
%legend('Test')
title('Crosslinked')
hold on
legend('numerical result')
hold off
X(end,:)
toc
end

2 commentaires

You try to set x(1) to a vector with 60 elements (logspace(-11,-5,60)).
I understand that, but I'm not sure how to seperate the two. I want to track the antibody species over the range as well as within each individual reaction. When I tried to set it to equal the currentab, i recieved an error about the cleared variable.

Connectez-vous pour commenter.

Réponses (1)

Torsten
Torsten le 20 Avr 2022
Modifié(e) : Torsten le 20 Avr 2022
Define x(1) in the k-loop:
...
x=zeros(6,1); % 6 species
%initialvalues:
%x(1) = Ab_0; % tracking antibody
x(2) = CD70_0; % CD70 receptors
x(3) = Cd4_0; % CD4 receptors
x(4) = 0; % monovalent bound CD70
x(5) = 0; % monovalent bound CD4
x(6) = 0; % Crosslinked antibodies
for k = 1:numel(Ab_0) % vector space which makes the size the size of the changing variable
x(1) = Ab_0(k);
currentAb = Ab_0(k); % current is a name of a new varialbe name to calculate psy and P
...

Catégories

En savoir plus sur MATLAB Parallel Server dans Centre d'aide et File Exchange

Produits

Version

R2021a

Question posée :

le 20 Avr 2022

Modifié(e) :

le 20 Avr 2022

Community Treasure Hunt

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

Start Hunting!

Translated by