Why does this code give error?

3 ビュー (過去 30 日間)
Sadiq Akbar
Sadiq Akbar 2021 年 5 月 4 日
コメント済み: Sadiq Akbar 2021 年 5 月 4 日
clear all
close all
N=100;
fc=1.0e9;
fs=20*fc;
w=2*pi*fc/fs;
n=0:N-1;
s=sqrt(1.0)*exp(i*w*n);
wn=sqrt(0.1/2)*(randn(1,N)+i*randn(1,N));
x=s+wn;
w_est=0;
M=N;
for m=1:M-1
w_est=w_est+(1/(M-1))*arg((x(m))'*x(m+1));
end
error_1=w-w_est;
w_est=0;
M=N;
for m=1:M-1
p(m)=6*(m)*(M-m)/(M*(M^2-1));
w_est=w_est+p(m)*arg((x(m))'*x(m+1));
end
error_2=w-w_est;

採用された回答

DGM
DGM 2021 年 5 月 4 日
Use angle() instead of arg() to get the argument of complex numbers.
  1 件のコメント
Sadiq Akbar
Sadiq Akbar 2021 年 5 月 4 日
Thank you very much dear DGM for your prompt respose.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePhysical Units についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by