how do I write this function on matlab ?
显示 更早的评论
v= √(〖v_x〗^2+〖v_y〗^2 )
θ=〖tan〗^(-1) (v_x/v_y )=arctan(v_x/v_y )
回答(1 个)
v = sqrt(v_x ^ 2 + v_y ^ 2) % [EDITED] Typo fixed
theta = atan(v_x / v_y)
Looks like a straight forward conversion.
Maybe v_x and v_y are arrays. Then use the elementwise operations:
v = sqrt(v_x .^ 2 + v_y .^ 2)
theta = atan(v_x ./ v_y)
3 个评论
Jan
2018-1-13
@Image Analyst: Thanks. From time to time I dare to fix obvious typos in the messages of others.
Image Analyst
2018-1-13
In the future I could, if you'd agree.
Jan
2018-1-13
Image Analyst, I agree. I appreciate your support.
类别
在 帮助中心 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!