[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
vector size conflict?
From: |
tessaract87 |
Subject: |
vector size conflict? |
Date: |
Thu, 6 Nov 2014 12:10:04 -0800 (PST) |
Hi all,
I'm working on implementing a model using differential equations. The main
function of the model looks like this:
function V=f(x,t)
BDR=0.016;
SPC=5.8*10^-3;
SC=0.01377;
SHC=0.025;
V=zeros(6,1);
V(1)=BDR*(V(2)+V(3))-(SRB(V(1),V(4))*V(2)+PS(V(1),V(6))*V(3));
V(2)=SRB(V(1),V(4))*V(2)-(BDR)*V(2);
V(3)=PS(V(1),V(6))*V(3)-BDR*V(3);
V(4)=SPC*V(5)-SRB(V(1),V(4))*SC*V(2)*V(5);
V(5)=PS(V(1),V(6))*SHC*V(3)*V(6)-SPC*V(5);
V(6)=SRB(V(1),V(4))*SC*V(2)*V(4)-PS(V(1),V(6))*SHC*V(2)*x(6);
endfunction
With SRB and PS being two functions as follows:
function[answer]=PS(i,w)
V=0.528;
KmC=0.22;
KmP=0.0002;
KmN=0.02;
KmSH=3;
PC=106;
PN=16;
answer=((V*i)/(KmP+i))*(i/((KmN/PN)+i))*(i/((KmC/PC)+i))*(w/(KmSH+w));
return
endfunction
and
function [answer]=SRB(i,y)
V=0.528;
KmC=0.22;
KmP=0.0002;
KmN=0.02;
KmS=3;
PN=16;
PC=106;
KmSH=3;
SRB=((V*i)/(KmP+i))*(i/((KmN/PN)+i))*(i/((KmC/PC)+i))*(y/(KmS+y));
return
endfunction
both of which should return scalar values.
However, when I attempt to run the file, I get the following error:
warning: SRB: some elements in list of return values are undefined
error: Venus: A(I) = X: X must have the same size as I
error: called from:
error: /home/tessa/Venus.m at line 16, column 5
Clearly, there's a conflict with the size of the vectors- but I can't figure
out where. Each equation in the main function should return a scalar value,
and this type of formatting has worked in other, example differential
equations I've looked at. What am I doing wrong?
Thanks!
--
View this message in context:
http://octave.1599824.n4.nabble.com/vector-size-conflict-tp4667241.html
Sent from the Octave - General mailing list archive at Nabble.com.
- vector size conflict?,
tessaract87 <=