autocorrelation plot without the grid of lines
Afficher commentaires plus anciens
Hi all,
I am using the function autocorr(). However, it produces the graph with a grid of vertical and horizontal lines.
Is there any way to remove them?
Best
Réponse acceptée
Plus de réponses (1)
Saurabh
le 13 Mai 2024
HI EKTOR,
Seems to me that by default the plot is having horizontal and vertical lines in, which iIs not required here as per the requirement.
To remove the grid lines from the graph, ‘grid’ function can be used.
Here is an example code for the above implementation:
% Example time series data
data = randn(100, 1); % Generate some random data
% Compute and plot the autocorrelation
autocorr(data);
With the above code we get this plot:

By adding one line of code, vertical and horizontal grid lines are eliminated:
% Example time series data
data = randn(100, 1); % Generate some random data
% Compute and plot the autocorrelation
autocorr(data);
% Turn off the grid for the current axes
grid off;

To get more idea about how grid works, have a look at this website:
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
