LS method in idetification ,control engeeniring

8 ビュー (過去 30 日間)
saeed
saeed 2024 年 5 月 12 日
回答済み: Aastha 2024 年 10 月 1 日
Hi,how are you?I have problem with that code,is about LS method with ARX model in identification,I should use xcorr command for EPS variable to compare it that how much is near to white noise ?
  4 件のコメント
saeed
saeed 2024 年 5 月 12 日
編集済み: Sam Chak 2024 年 5 月 12 日
clc, clear, close all, N=100; e=100*randn(1,N); x=1:N; a2=0.5; a1=1; a0=2; y=a2*x.^2+a1*x+a0+e; plot(x,y,'Linewidth',2); phi=ones(N,1); Y=y'; theta_hat=phi./Y; Y_hat=phi.*theta_hat; Eps=Y-Y_hat; V0=Eps'*Eps/2; hold on, plot(x,Y_hat,'LineWidth',2); clear phi theta_hat
saeed
saeed 2024 年 5 月 12 日
How can I compare Eps with e by xcorr command to know that error is atleast near to white noise

サインインしてコメントする。

回答 (1 件)

Aastha
Aastha 2024 年 10 月 1 日
Hi saeed,
As I understand, you want to compare the error variable Eps" between Y and Y_hat”  with the white noise realization e using the "xcorr" function in MATLAB. This can be done using the following code snippet:
[cross_corr, lags] = xcorr(Eps, e, 'normalized');   
You may refer to the link of MathWorks documentation for further information on “xcorr” function. Here is the link to it:
The "xcorr" function computes the cross correlation between Eps and "e. The "normalised" argument normalizes the sequences so that the autocorrelations at zero lag is equal to 1.
The function returns two variables, first one is lags which contains all the lags at which cross correlation has been computed and the second variable cross_corr contains the corresponding cross correlation values.
You can visualize the cross relation using the "stem" function in MATLAB. The code snippet below illustrates the same:
stem(lags,c);
For more information on “stem” function, you may refer to the documentation link below:
I hope this helps!

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by