Plotting sin (x/x) function in terms of Mag(dB) over Frequency

7 ビュー (過去 30 日間)
IFECHUKWU IKE-ORJI
IFECHUKWU IKE-ORJI 2022 年 11 月 17 日
コメント済み: IFECHUKWU IKE-ORJI 2022 年 11 月 18 日
x=linspace(-20,20);
y= sin(x)./x;
y1 = (10*log(y));
plot(x,y1,'-')
Warning: Imaginary parts of complex X and/or Y arguments ignored.
This is currrently the code i have running but not getting the resulting sin x/x plot, but more so a rectified version of it. i also wanted some help in changing the x axis from linear to frequency(preferably in rad/s), similar to how i changed y from linear to dB.
the sin x/x plot work when using just "plot(x,y)" but now when trying to change the axis to dB and Freq.
;

採用された回答

Paul
Paul 2022 年 11 月 18 日
Hi IFECHUKWU,
sin(x)/x can take on negative values, for example
x = 5*pi/4;
sin(x)/x
ans = -0.1801
Taking the log10 (as neeed for dB, not log) of a negative number yields a complex result
log10(ans)
ans = -0.7446 + 1.3644i
Not sure what kind of plot is expected after converting the result dB.
  1 件のコメント
IFECHUKWU IKE-ORJI
IFECHUKWU IKE-ORJI 2022 年 11 月 18 日
my question was a bit unclear as i was referring to dBm not dB, so you would be right resulting the sin (x/x) waveform being rectified

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by