possible parameter division rounding error?
1 view (last 30 days)
Show older comments
Hi, I have a large set of parameters and about half of them I define by dividing by some experimental value, like so:
kd=.06;c2=.01;
c1=c2/kd;
However, this seems to result in some errors. These parameters in particular act as a kind of switch, and the output looks like they are at zero. If I manually define c1=.17, then I see the expected output.
Is this possibly some rounding error Matlab is making, or do I have some error in passing the values?
I'm attaching my graphing + ode file. Thanks!
2 Comments
John D'Errico
on 4 Mar 2015
No. MATLAB is not making a rounding error, and will certainly not do this only sometimes. But we really do not know exactly what you have done here, as you say it results in "some" errors. Either it gives an unexpected result or it does not. Please show what you actually did that gave you a result you did not expect.
You may be stuffing the result into an integer variable. Or, possibly you are doing a divide between vectors, and do not realize that you need to be using ./ and not / as the operator.
Answers (1)
per isakson
on 4 Mar 2015
Edited: per isakson
on 4 Mar 2015
I downloaded your files. What am I supposed to do next? I run graph
>> graph
Undefined function or variable 'tdata'.
Error in graph (line 55)
plot(tdata, ydata,'*',t, X(:,11),'+')
and got an error, which doesn't resemble your description of the problem. Next I set stop on error
 
and run graph again
 
the execution halted at plot and I confirmed that tdata and ydata were not defined at that point in the code. More guessing: I removed these to variable from plot
 
and run graph again
 
to me the result looks fine
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!