Unable to perform assignment because the left and right sides have a different number of elements.

조회 수: 1 (최근 30일)
This is my auto-regulated construct. Does anyone know why prod_ratea=g_ar*((theta.^n_hill)./((theta.^n_hill)+(x_ar.^n_hill))); does not change and update when x_ar increases or decreases? That's why I get the error message.
t_max= 1200; % in s
k=0.01; % in s^-1
step_counter=1;
t=0;
g_nr=2;
x_nr=5;
g_ar=4;
n_hill=8;
x_ar=5;
t_ar=0;
theta=(g_nr)/k;
% Perturbations
perturbation_magnitude=150; % in molecules
perturbation_time_400=400;% in s
perturbation_time_800=800;% in s
is_perturbation_400=0;
is_perturbation_800=0;
while t<t_max
prod_ratea=g_ar*((theta.^n_hill)./((theta.^n_hill)+(x_ar.^n_hill)));
deg_rate=k*x_ar;
wait_time=-log(rand)./((prod_ratea)+(deg_rate(step_counter)));
prob_prod=prod_ratea./((prod_ratea)+(deg_rate(step_counter))); % Propensity of production
t=t+wait_time; % Update current time
step_counter=step_counter+1; % Update the number of steps (reactions) associated with the experiment.
t_ar(step_counter)=t; % Add the current time to the time log
if rand < prob_prod % Defines whether production takes place based on Monte Carlo method.
x_ar(step_counter)=x_ar(step_counter-1)+1; % Implements production
else
x_ar(step_counter)=x_ar(step_counter-1)-1; % Implements degradation
end
if t > perturbation_time_400 && is_perturbation_400==0
x_ar(step_counter)=x_ar(step_counter)+perturbation_magnitude;
is_perturbation_400=1;
end
if t > perturbation_time_800 && is_perturbation_800==0
x_ar(step_counter)=x_ar(step_counter)-perturbation_magnitude;
is_perturbation_800=1;
end
if t>t_max
t_ar(end)=[];
x_ar(end)=[];
end
end

답변 (1개)

Image Analyst
Image Analyst 2022년 6월 7일

카테고리

Help CenterFile Exchange에서 Scripts에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by