Subscript indices must either be real positive integers or logicals. Not getting why this is happening?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Walter Roberson
le 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)
Plus de réponses (1)
Image Analyst
le 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.
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!