possible parameter division rounding error?

조회 수: 1 (최근 30일)
Renee
Renee 2015년 3월 3일
편집: per isakson 2015년 3월 4일
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
John D'Errico
John D'Errico 2015년 3월 4일
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 2015년 3월 4일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

per isakson
per isakson 2015년 3월 4일
편집: per isakson 2015년 3월 4일
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

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by