I have created this simple functon file to call other functions.
function [conc ] = getconc( expConditions,parVector ) c(1) = expConditions(1); c(2) = expConditions(2); c(3) = expConditions(3); [t cout1] = ode45('model1',[0:1:9],expConditions); [t cout2] = ode45('model2',[0:1:9],expConditions); [t cout3] = ode45('model3',[0:1:9],expConditions); [t cout4] = ode45('model4',[0:1:9],expConditions); [t cout5] = ode45('model5',[0:1:9],expConditions); [t cout6] = ode45('model6',[0:1:9],expConditions); [t cout7] = ode45('model7',[0:1:9],expConditions); [t cout8] = ode45('model8',[0:1:9],expConditions); [t cout9] = ode45('model9n',[0:1:9],expConditions); [t cout10] = ode45('model10',[0:1:9],expConditions); conc=[cout1(:,1) cout2(:,2) cout3(:,1) cout4(:,2) cout5(:,1) cout6(:,2) cout7(:,1) cout8(:,2) cout9(:,1) cout10(:,2)];
end I give inputs for expConditions and parVector as [1 1 1 1 1 1 1 1 1 1] and [5 5 50]. I am getting the following error :
Attempted to access parVector(1); index out of bounds because numel(parVector)=0.
The parVector input is required in my function files which i am calling for ode45solver. example for ne model function file is as follows
function [fdot] = model1(t,c,parVector )r=-parVector(1);fdot(1)=r;fdot(2)=r;fdot(3)=0;fdot=fdot'
I am calling function as follows:
>> parVector=[1 1 1 1 1 1 1 1 1 1];>> expConditions=[5 5 50];>> getconc(parVector,expConditions);
Best Answer