MATLAB busy for all the time after the code is executed

22 Ansichten (letzte 30 Tage)
Taimoor Khan Mehmand
Taimoor Khan Mehmand am 13 Mär. 2023
Kommentiert: Jan am 14 Mär. 2023
I have one more query. In my code it seems there is an infinite loop going on and the MATLAB is busy for so long that I had to stop the debugging. Initially I was facing the "array exceeding maximum array size preference" error which was in this line of the code below Step 2 : h_k = freq_signal - mean_env;. In that case, the error was likely caused by the fact that freq_signal or mean_env is a very large array. The subtraction operation between the two arrays would result in an array of the same size, which could potentially exceed MATLAB's maximum array size preference. To fix this issue, I tried breaking up the input signal into smaller segments and processing each segment separately. This would reduce the memory requirements of the operation and prevent MATLAB from running out of memory. So I did the following. Input signal freq_signal is broken up into segments of size segment_size, and the envelope() function is applied to each segment separately. The resulting mean_env arrays are then averaged to obtain the final mean_env
  7 Kommentare
Taimoor Khan Mehmand
Taimoor Khan Mehmand am 14 Mär. 2023
@Stephen23 I attached the approach with explanation of each step in the attcahement section. My code is for the appraoch that is attached.
Jan
Jan am 14 Mär. 2023
The problem is not inside:
if max(abs(mean_env)) < 1e-10
is_imf = true;
c_j = h_k;
but that the algroithm to calcualte mean_env does not produce such small values.
You can use the debugger or some fprintf commands to track the values of upper_env, lower_env and mean_env.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Cris LaPierre
Cris LaPierre am 13 Mär. 2023
It sounds like you're encountering an infinite loop in your while loop. Your conditional is is_imf, so it looks like you are never entering the following condition.
if max(abs(mean_env)) < 1e-10
is_imf = true;
c_j = h_k;
This suggests your constraint is either not appropriate for your data, or there is a mistake in calculating mean_env, as the values do not match the assumptions made when writing the code.

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by