How to vectorize this function?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have the following function:
x3=@(phi) (R-((3-2.*sin(phi))/(1-0.5.*sin(phi)).*R)/4).*cos(phi)
I read some articles saying I have to use elementwise operations but I still get a warning.
Thanks in advance!
댓글 수: 0
답변 (1개)
Alan Stevens
2021년 1월 10일
You need a ./ (i.e. dot /)
x3=@(phi) (R-((3-2.*sin(phi))./(1-0.5.*sin(phi)).*R)/4).*cos(phi)
^
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!