Is multiplying a matrix or a constant with another constant and multiplying a const. with a variable which stores a constant different?

Respected Sirs, I have a loop running about 1000 times.I am using an equation like
while...
for i=1:3
x(i) = a(i) + a(i)*(b(:,i)).^1.2
end
end
and i'm getting some output, BUT when i use this form
b=1.2;
while...
for i=1:3
x(i) = a(i) + a(i)*(b(:,i)).^b
end
end
i get output as [NaN NaN]
why is it happening?? please help!!

 採用された回答

per isakson
per isakson 2014 年 3 月 1 日
編集済み: per isakson 2014 年 3 月 1 日
Here are some links on debugging in Matlab
.
BTW: b=1.2; overwrites the array b(:,i)

その他の回答 (0 件)

カテゴリ

質問済み:

2014 年 3 月 1 日

編集済み:

2014 年 3 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by