Error in storing for loop iterations
1 次查看(过去 30 天)
显示 更早的评论
I am trying to store the values of each for loop iteration so I could plot them in respect to time. However, it keeps giving me the error:
Array indices must be positive integers or logical values.
Error in Rheology (line 16)
s_qtz(i) = A_qtz*(str.^n_qtz)*exp(-Ea_qtz/(R*i));
I am not quite sure of what to do to fix this error. I provided my code below.
%stress array
str = [0.1, 1, 10, 100];
%Constants
R = 8.314;
A_qtz = 1.26e-5;
n_qtz = 3;
Ea_qtz = 2.42e5;
%temp array
T = [973.15:100:1373.15];
for i = T
s_qtz(i) = A_qtz*(str.^n_qtz)*exp(-Ea_qtz/(R*i));
end
0 个评论
回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!