auto correlation plotting using function

4 visualizzazioni (ultimi 30 giorni)
Ali
Ali il 8 Gen 2023
Commentato: Ali il 8 Gen 2023
i dont understand a section of the function code which makes the auto correlation plotted by holding space bar which plots the next value of the correlation as long as i move the time shiftted signal under the correlated signal with space bar.
that section of the code starts at line 48
normalised_shift_size = 2*plot_width/(num_steps-1);
corr_seg_len = length(rxy)/num_steps;
for k = 1 : num_steps
if(k > 1)
new_pos = get(mid_ax_h,'position') + [normalised_shift_size 0 0 0];
set(mid_ax_h,'position', new_pos);
end
set(corr_h, 'Ydata', [rxy(1:round(corr_seg_len*k)) ones(1,length(rxy)-round(corr_seg_len*k))*NaN])
pause
end

Risposta accettata

Image Analyst
Image Analyst il 8 Gen 2023
That's what the pause function does. If you want more info, look up documentation for pause
help pause
PAUSE Wait for user response. PAUSE(n) pauses for n seconds before continuing, where n can also be a fraction. The resolution of the clock is platform specific. Fractional pauses of 0.01 seconds should be supported on most platforms. PAUSE causes a procedure to stop and wait for the user to strike any key before continuing. NOTE: The maximum pause is 2 seconds for this product offering on this platform. PAUSE OFF indicates that any subsequent PAUSE or PAUSE(n) commands should not actually pause. This allows normally interactive scripts to run unattended. PAUSE ON indicates that subsequent PAUSE commands should pause. PAUSE QUERY returns the current state of pause, either 'on' or 'off'. STATE = PAUSE(...) returns the state of pause previous to processing the input arguments. The accuracy of PAUSE is subject to the scheduling resolution of the operating system you are using and also to other system activity. It cannot be guaranteed with 100% confidence, but only with some expected error. For example, experiments have shown that choosing N with a resolution of .1 (such as N = 1.7) leads to actual pause values that are correct to roughly 10% in the relative error of the fractional part. Asking for finer resolutions (such as .01) shows higher relative error. Examples: % Pause for 1 seconds pause(1) % Temporarily disable pause pause off pause(1) % Note that this does not pause pause on % Aternatively, disable/restore the state pstate = pause('off') pause(1) % Note that this does not pause pause(pstate); See also KEYBOARD, INPUT. Documentation for pause doc pause Other uses of pause audioplayer/pause slrealtime.Target.Stimulation/pause parallel-computing/pause
  1 Commento
Ali
Ali il 8 Gen 2023
yes, but i dont understand the code concept where i update the location of the time shifted signal using
+[normalised_shift_size 0 0 0]
since i dont know the meaning of the next 2 lines
normalised_shift_size = 2*plot_width/(num_steps-1);
corr_seg_len = length(rxy)/num_steps;
and that part
set(corr_h, 'Ydata', [rxy(1:round(corr_seg_len*k)) ones(1,length(rxy)-round(corr_seg_len*k))*NaN])

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by