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!

采纳的回答

Walter Roberson
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
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.

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by