Hello guys, might be sort of a beginners question for most of you guys but i am really having trouble tat ploting an autocorrelation function like the example one mentioned in the help section of the function browser "autocorr(econ)"? Any chance somebody could give me a hint on how to plot it alongside with the bounds and label x/y according to the example? many thanks stefan

 채택된 답변

Wayne King
Wayne King 2012년 6월 11일

5 개 추천

x = randn(1000,1); % 1000 Gaussian deviates ~ N(0,1)
y = filter([1 -1 1],1,x); % Create an MA(2) process
[acf,lags,bounds] = autocorr(y);
stem(lags,acf); xlabel('Lag'); ylabel('\rho(k)');
hold on;
h = line(lags,bounds(1)*ones(length(acf),1));
h1 = line(lags,bounds(2)*ones(length(acf),1));
set(h,'color',[1 0 0]);
set(h1,'color',[1 0 0]);

댓글 수: 3

stefan strasser
stefan strasser 2012년 6월 21일
Thank you very much Wayne! This was of big help!
Kevin Holst
Kevin Holst 2012년 6월 21일
Make sure you click 'Accept Answer' so the helpers on here know you've got what you needed.
Bill Tubbs
Bill Tubbs 2020년 2월 4일
Note: 'autocorr' requires Econometrics Toolbox.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Yashwanth
Yashwanth 대략 6시간 전

0 개 추천

%ECE24063
clc;
clear;
close all;
% Parameters
Am = 5;
fm = 2e3;
fc = 10 * fm;
t = 0:1e-6:2e-3;
% Message signal
m = Am * cos(2*pi*fm*t);
% Modulation index values
beta_values = [0.5, 2, 10];
figure;
for i = 1:length(beta_values)
beta = beta_values(i);
% Frequency Modulated Signal
s = cos(2*pi*fc*t + beta * sin(2*pi*fm*t));
subplot(3,1,i);
plot(t, s);
title(['FM Signal for \beta = ', num2str(beta)]);
xlabel('Time');
ylabel('Amplitude');
end

카테고리

질문:

2012년 6월 11일

답변:

2026년 9월 2일 15:20

Community Treasure Hunt

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

Start Hunting!

Translated by