There is an error in the code that I can't seem to correct.
Code:
for i = 1:26
T(i,1)=T0;
k1(i,1)=A1*exp(-E1/(R*T(i,1))); --> ERROR "Subscripted assignment dimension mismatch."
end
I tried adding decimals and that didn't seem to work. After the first time through the loop, i and T are both 1x1 in size.

 採用された回答

Titus Edelhofer
Titus Edelhofer 2012 年 5 月 5 日

0 投票

Hi,
and what about A1, E1, R? Are they 1x1 as well or is one of them a vecotr/matrix?
Titus

1 件のコメント

not the man
not the man 2012 年 5 月 5 日
R was an array, but was supposed to be constant

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2012 年 5 月 5 日

0 投票

If A1, E1, or R are matrices, they must be the same length as each other. The size of T does not matter since you are just using one element of it, which is a scalar. Are any of A1, E1, or R two-D arrays? I hope not but why do you have a second dimension of 1? So, assuming they're all scalars or same-length vectors, you must use .* and not *, and ./ instead of /.
k1(i,1) = A1 .* exp(-E1 ./ (R .* T0))
If they're not arrays, it will still work. Note, I also replaced T(i,1) by T0 since they are the same, according to the way you wrote your code.

カテゴリ

ヘルプ センター および File Exchange で Resizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by