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

回答(2 个)

Image Analyst
Image Analyst 2021-3-8

Walter Roberson
Walter Roberson 2021-3-8

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by