Does the code generated with Real-Time Workshop execute faster than the same application built in MATLAB?

1 view (last 30 days)
I have Simulink model which computes the Eigen Vectors for a matrix and I generated code for the model using Real-Time Workshop. I also wrote an M-script which computes the eigen vectors for the matrix used in the Simulink model. I observe that the M-script is faster than the Real-Time Workshop generated executable.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The reason for the performance difference is that the MATLAB routine EIG uses a highly optimized FORTRAN based library to do the computation which has an advantage over the C based function generated using the MATLAB Embedded Function block. In general, all matrix based computations have a slight advantage in MATLAB when compared to their counterparts developed in C due to the advantages of vectorized matrix reading in FORTRAN and MATLAB compared to the loop based matrix operations in C/C++.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!