autocorrelation plot without the grid of lines
조회 수: 2 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Mathieu NOE
2024년 5월 13일
hello
you can remove the grid by specifying grid off after the plot
Mdl = arima(AR={0.75,0.15},SAR={0.9,-0.5,0.5}, ...
SARLags=[12 24 36],MA=-0.5,Constant=2, ...
Variance=1);
% Simulate data from Mdl.
rng(1); % For reproducibility
y = simulate(Mdl,1000);
% Plot the default autocorrelation function (ACF).
figure
autocorr(y)
grid off
댓글 수: 0
추가 답변 (1개)
Saurabh
2024년 5월 13일
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:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!