Looking to use region-zoom interaction following the ginput selection
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I wanted to know whether there was a way to use the region-zoom interaction following an initial ginput selection on the graph.
I am currently using a 1000 ms (1s) on the x-axis of my graph to pick the region of interest using ginput. After having clicked a point, I want the graph to zoom in to a 50ms window (25ms on each side of my initial point). It is in this 50ms window of higher resolution I wish to make a final marking that would then output in my dataset. Any soloutions?
0 commentaires
Réponses (1)
Neha
le 31 Août 2023
Hi Sayyam,
I understand that you want to zoom in to a specific region of interest after using "ginput" to select a point on the graph. You can refer to the following code snippet:
x = linspace(0, 1000, 1000); % x-axis values (1000 ms)
y = sin(2*pi*0.01*x); % y-axis values
plot(x, y)
xlabel('Time (ms)')
ylabel('Amplitude')
title('Zoom-in Example')
% Use ginput to select a point on the graph
[x_selected, ~] = ginput(1);
% Define the zoom window size
zoom_window = 50; % 50 ms
% Calculate the x-axis limits for the zoomed region
x_zoom_start = x_selected - zoom_window/2;
x_zoom_end = x_selected + zoom_window/2;
% Set the x-axis limits for the zoomed region
xlim([x_zoom_start, x_zoom_end])
% Prompt the user to make a final marking in the zoomed region
[x_final, ~] = ginput(1);
fprintf('Final marking: %.2f ms\n', x_final);
Hope this helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!