Subscript indices must either be real positive integers or logicals. Not getting why this is happening?
1 回表示 (過去 30 日間)
古いコメントを表示
x=[.4 1 1.4 1.9 2.4]
y=[.3 .6 .9 1.2 1.5]
for (i=1:10)
for (j=1:10)
T(x,y)=x.^2+.6.*x.*y.^3-2.*y.^4
end
end
surf(T')
Thats what I have and it keeps giving me the error on my formula. I googled this but I should have rational numbers. Lost. Please help!
0 件のコメント
採用された回答
Walter Roberson
2014 年 3 月 20 日
You are using x as a subscript in T(x,y)=x.^2+.6.*x.*y.^3-2.*y.^4 . Your first x is 0.4 which is not a positive integer
Assign to T(j,i) instead.
(I immediately see another problem but I will let you find it)
その他の回答 (1 件)
Image Analyst
2014 年 3 月 20 日
x and y are row and column so you can't have the 0.4th row of a matrix. You can't have the 0.3th column. You can make T an image array but you need to give it integer row and column, not fractional x and y values.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!