possible parameter division rounding error?

1 visualización (últimos 30 días)
Renee
Renee el 3 de Mzo. de 2015
Editada: per isakson el 4 de Mzo. de 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 comentarios
John D'Errico
John D'Errico el 4 de Mzo. de 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 el 4 de Mzo. de 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.

Iniciar sesión para comentar.

Respuestas (1)

per isakson
per isakson el 4 de Mzo. de 2015
Editada: per isakson el 4 de Mzo. de 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

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by