Cost of Modwpt function
5 views (last 30 days)
Show older comments
Hello,
I have been trying to use the "modwpt" function in a MATLAB function block in a HIL system running real-time. I am encountering overruns at a sample time of 125e-6. This sample time is quite large for application and I would like to go lower.
I would like to understand the cost of the "modwpt" function, since removing the function reduces the computation time by a significant amount.
How can I understand or compute this?
Answers (1)
Sai Pavan
on 18 Oct 2023
Hi Abhishek,
I understand that you want to know the cost of using the “modwpt” function.
To understand the computational cost of the "modwpt" function in MATLAB, you can use the MATLAB Profiler tool. The Profiler provides information about the execution time and resource usage of your code, which can help you identify performance bottlenecks.
Please follow the below workflow to know the cost of “modwpt” function:
- Open the MATLAB Profiler by typing “profile viewer” in the MATLAB Command Window.
- In the Profiler window, click on the "Start Profiling" button to start the profiling session.
- Run your MATLAB code that includes the "modwpt" function.
- Once your code execution is complete, click on the "Stop Profiling" button to stop the profiling session.
- The Profiler window will display a summary of the profiling results, including the function call tree, execution time, and other metrics.
- In the function call tree, you can navigate to the "modwpt" function to see its individual execution time and the functions called within it.
Keep in mind that the computational cost of the "modwpt" function can vary depending on the input data and the specific parameters used. It's recommended to profile your code with representative inputs to get a more accurate understanding of the function's cost in your specific use case. This can help you gain insights into the computational cost of the "modwpt" function and identify potential optimizations to reduce the execution time in your real-time HIL system.
Please refer to the below documentation to learn more about profile execution time for functions: https://www.mathworks.com/help/matlab/ref/profile.html
Hope it helps.
Regards,
Sai Pavan
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!