How to vectorize these nested for loops

1 view (last 30 days)
Kai Jensen
Kai Jensen on 17 Feb 2019
for i=1:knum
for j=1:knum
cp1(i,j)=max(pf(kgrid(i))+(1-depreciation)*kgrid(i)-kgrid(j),0);
vp1(i,j)= log(cp1(i,j))+(beta*vp2(j));
end
end
How can I vectorize these 2 nested for loops?

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!