I'm trying to vectorize my for loop, what would be the best method?
    조회 수: 2 (최근 30일)
  
       이전 댓글 표시
    
clear all
Linearparams=[3.5,1.0];
nonLinearParams=[5];
timevals=[0:.01:4.99];
n=length(timevals)
for i=1:n
    yvals(i)=Linearparams(1)*timevals(i)+Linearparams(2)+sin(nonLinearParams*timevals(i));
end
댓글 수: 0
채택된 답변
  Matt J
      
      
 2023년 9월 6일
         yvals=Linearparams(1)*timevals+Linearparams(2)+sin(nonLinearParams*timevals);
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Automated Driving Toolbox에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

