possible parameter division rounding error?

1 Ansicht (letzte 30 Tage)
Renee
Renee am 3 Mär. 2015
Bearbeitet: per isakson am 4 Mär. 2015
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 Kommentare
John D'Errico
John D'Errico am 4 Mär. 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.
Renee
Renee am 4 Mär. 2015
By "some errors" I mean unexpected output, yes (caused by several parameter issues). I attached the relevant files. All my parameters are of type double, and in my ODE file I use the vector operator.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

per isakson
per isakson am 4 Mär. 2015
Bearbeitet: per isakson am 4 Mär. 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
&nbsp
and run graph again
&nbsp
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
&nbsp
and run graph again
&nbsp
to me the result looks fine

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by