[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error: subscript indices must be either positive integers or logical
From: |
veryhappy |
Subject: |
Re: Error: subscript indices must be either positive integers or logicals - For simple surf plot |
Date: |
Thu, 24 Nov 2011 14:47:50 -0800 (PST) |
function f(g)
for a=0:pi
for b=0:pi
c(a+1,b+1)=tan(g*a) * arcsin(g*b);
end
end
surf(c);
That should work but try:
function f(g)
a=0:pi;
b=0:pi;
[aa,bb]=meshgrid(a,b);
c=tan(g.*aa).*arcsin(g.*bb);
surf(c);
endfunction
It should give you the same results with better perfomance
--
View this message in context:
http://octave.1599824.n4.nabble.com/Error-subscript-indices-must-be-either-positive-integers-or-logicals-For-simple-surf-plot-tp4105648p4105853.html
Sent from the Octave - General mailing list archive at Nabble.com.