Knowledge Base
Welcome to OPAL-RT’s Knowledge Base
OPAL-RT offers a repository of support information for optimal use of its technology.
Please note that OPAL-RT knowledge base is not fully optimized for mobile platforms.
For optimal experience, use a desktop computer.
Reference Number: AA-02172
// Views: 31
// Created: 2023-05-05 13:19:43
// Last Updated: 2023-05-19 13:39:05
HowTo
HYPERSIM: How to transform Cartesian to Polar and Polar to Cartesian in HYPERSIM using a C Code block MATLAB has library blocks for converting Cartesian to Polar and Polar to Cartesian. There are no equivalent blocks in the HYPERSIM library to perform this calculation. SPS block C to P SPS block P to C To carry out this calculation in HYPERSIM, a C code block with the following code can be implemented to reproduce the same behavior. Cartesian to Polar r = sqrt(x*x + y*y); theta = atan2(y,x); -- and Polar to Cartesian -- x = r * cos(theta); y = r * sin(theta); -- |