Trying to generate bode plot data for a 8196 points fft. it takes too long and never ends the calculation, what to do?

6 ビュー (過去 30 日間)
Hello,
i am trying to get the data for Bode and Nyquist plot using a FFt with 8196 points. I got the sine sweep move using a dc motor and got the data. Converted it to fft and calculated the Transfer Function. All i need is to plot the bode plot but it takes a lot time and never ends (tried for 30 minutes and then killed matlab). So is there a way to increase the speed or make it efficient to get data faster?
I tried the same using less number of points i.e. 512,1024,2196 and took 2 minutes, 5 minutes and 12 minutes.
I want to get faster results.

回答 (1 件)

Pratyush
Pratyush 2024 年 5 月 30 日
Hi Harshul,
To speed up Bode and Nyquist plot generation from FFT data in MATLAB, especially with a large dataset, consider the following strategies:
1. Optimize FFT Calculation
- Use fewer points if high resolution isn't critical.
- Ensure the number of points is a power of 2 for efficiency.
2. Efficient Transfer Function Calculation
- Vectorize calculations to avoid loops.
- Use sparse matrix operations if applicable.
3. Plotting Optimization
- Decimate data to plot fewer points without losing plot integrity.
- Use efficient plotting functions like 'semilogx' or 'semilogy'.
4. Parallel Computing
- Utilize MATLAB's Parallel Computing Toolbox for faster computations.
5. Efficient Data Handling
- Preallocate arrays to avoid dynamic resizing.
- Choose appropriate data types ('single' vs. 'double') based on precision needs.
6. Use MATLAB Profiler
- Identify and address bottlenecks in your code with MATLAB's profiler.
Hope this helps.

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by