Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: feed vectors into fzero for speed
Date: Sun, 19 Apr 2009 20:42:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <gsg2ap$dts$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1240173721 14268 172.30.248.38 (19 Apr 2009 20:42:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 19 Apr 2009 20:42:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1639292
Xref: news.mathworks.com comp.soft-sys.matlab:533915

n=1000
Assume vectors a & b have the following dimension
a(n,1)
b(n,1)
f0=[.001,3.5];
xstar=zeros(n,n)
for i=1:n
for j=1:n
anew=a(i)
bnew=b(j)

f=@(x) anew*x^alpha+bnew*x^beta+constant % alpha and beta are real no
xstar(i,j)=fzero(f,f0)
end
end

this for loop is inside another while loop and hence the run time is very high.
So my question is......
Is there a way to feed vectors a and b into fzero in one step without using the for loop to compute the value of xstar for every possible combination of elements in a and b 
Thanks,
Dhrue