Subscript indices must either be real positive integers or logicals. Not getting why this is happening?

2 views (last 30 days)
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!

Accepted Answer

Walter Roberson
Walter Roberson on 20 Mar 2014
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)

More Answers (1)

Image Analyst
Image Analyst on 20 Mar 2014
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.

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!