NEED HELP!! How can we optimize DEKF (Dual Extended Kalman Filter) matlab code?

6 ビュー (過去 30 日間)
Tauqeer Anjum
Tauqeer Anjum 2023 年 6 月 20 日
コメント済み: Tauqeer Anjum 2023 年 6 月 21 日
I am trying to use the DEKF matlab code which takes agee to compute the result. I am passing a dataArr = 100*120 matrix as the input with p=1. The matrix multiplications inside the code are taking too much time. Is there any possible way to improve it and speed up the process. It takes 98% of the total computation time for my other job and i have to access the same function thousands of time for my work. Any help would be greatly appreciated.
The original matlab code is available at

回答 (1 件)

Shishir Reddy
Shishir Reddy 2023 年 6 月 20 日
Hi Tauqeer,
As per my understanding, you want to improve the performace of matrix multiplications in MATLAB.
For which, you can consider the following optimization techniques:
  1. Vectorization: MATLAB is optimized for performing operations on arrays, so it's generally faster to perform matrix operations using array/vector operations rather than looping through individual elements. Ensure that your code is vectorized by using MATLAB's array operations whenever possible.
  2. Preallocation: If you're repeatedly performing matrix multiplications inside a loop, preallocating the output matrix can significantly improve performance. Preallocation avoids the need for MATLAB to reallocate memory during each iteration of the loop.
  3. Matrix Decomposition: If you're performing the same matrix multiplication multiple times with the same matrices, you can consider decomposing the matrices (e.g., LU decomposition, QR decomposition) and reusing the decomposition results to avoid redundant calculations.
  4. Parallel Computing: If your system has multiple cores or processors, you can utilize MATLAB's Parallel Computing Toolbox to parallelize the matrix multiplications. This can speed up the computations by distributing the workload across multiple cores.
  5. MATLAB Compiler: If the above techniques are not sufficient to achieve the desired performance, you can consider using the MATLAB Compiler to convert your MATLAB code into a standalone executable or a shared library. This allows you to leverage MATLAB's optimization capabilities and compile the code into a more efficient form.
  6. Profiling: Use MATLAB's profiling tools (e.g., the Profiler) to identify performance bottlenecks in your code. The profiler can help you pinpoint which parts of your code are taking the most time, allowing you to focus your optimization efforts where they will have the most impact.
I hope this resolves the issue.
  1 件のコメント
Tauqeer Anjum
Tauqeer Anjum 2023 年 6 月 21 日
I am actually trying to get the help to improve already available DEKF matlab function. The bottleneck is this function, which takes 98% of the total execution time. I have already tried a few of the optimization techniques you mentioned but not a significant difference was detected. Thank you

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by