Can these operations be vectorized?
이전 댓글 표시
n1=-64:63;
Inter=sinc(n1/9);
Poly=reshape(Inter,8,16);
X=repmat([1,-1],1,10);
for i=1:8
A(i,:)=conv(Poly(i,:),X);
end
So in this small program I am storing in Matrix A, the output of a convolution operation. Each Row of A represents the output for one iteration. Now my Question is can I get this done without using the for loop. Like by using bsxfun or anything? Please suggest.
채택된 답변
추가 답변 (2개)
Sachin Ganjare
2012년 10월 29일
편집: Sachin Ganjare
2012년 10월 29일
0 개 추천
Rather use 'onvmtx' function.
There are ways, but it will probably be slower. For loops are not necessarily bad. Look at the answer here for a problem similar to yours.
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!