How to vectorize this function?
8 次查看(过去 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!