Array indices must be positive integers or logical values.
显示 更早的评论
Error in TASKA (line 22)
A(t)=(A0-B0/YB)./(1-(B0/(YB*A0))*exp(-((YB*A0/B0)-1)*K*B0.*t));
5 个评论
David Hill
2022-3-6
What is the value of t? The only thing you are indexing into is A. The error appears to tell you that t is not a positive integer or logical value.
Navaneetha Krishnan Murugadoss
2022-3-6
David Hill
2022-3-6
You cannot index with 0 (indexing for matlab starts at 1)
Navaneetha Krishnan Murugadoss
2022-3-6
David Hill
2022-3-6
Cannot help further unless you provide more information (all variables with values and context)
回答(2 个)
Image Analyst
2022-3-6
A thorough discussion is in the FAQ:
In the meantime, try getting rid of (t) on the left hand side.
A = (A0-B0/YB) ./ (1-(B0/(YB*A0)) .* exp(-((YB*A0/B0)-1)*K*B0 .* t));
Navaneetha Krishnan Murugadoss
2022-3-6
3 个评论
Image Analyst
2022-3-6
编辑:Image Analyst
2022-3-6
You posted this as the "Answer".
So, did this "Answer" of your fix it? Otherwise take another look at my answer.
Navaneetha Krishnan Murugadoss
2022-3-6
plot(rand(1,5), '-o')
plot(rand(1,5), '-O')
plot(rand(1,5), '-0')
which is to say that your '-0' is dash-zero and that is not a recognized line style or color. Using dash-oh or dash-capital-oh is fine.
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

