Converting a linear equation to decibel

2 Ansichten (letzte 30 Tage)
flanker989
flanker989 am 18 Sep. 2021
Kommentiert: Star Strider am 18 Sep. 2021
I'm trying to convert a linear polar plot to decibel but I don't know how to proceed. Here is the original:
theta = 2*pi*linspace(0, 1, 30);
r = cos(theta/2).^2;
polar(theta, r, 'r-');
This is my progress so far:
theta = 2*pi*linspace(0, 1, 30);
r = 10*log10(abs(cos(theta/2).^2));
b = find(r(-40))
b == -40
b = b + 40
polardb(theta, r, -40, 'r-');
I don't know how to proceed.

Akzeptierte Antwort

Star Strider
Star Strider am 18 Sep. 2021
The ‘theta’ vector likely needs to have more points, however that appears to be correct.
I use a slightly different approach here —
theta = 2*pi*linspace(0, 1, 30);
r = cos(theta/2).^2;
figure
polarplot(theta, r, 'r-')
title('r(\theta)')
figure
polarplot(theta, mag2db(r), 'r-')
title('r(\theta) (dB)')
rt = rticklabels;
rticklabels(cellfun(@(x)sprintf('%s dB',x),rt', 'Unif',0))
.
  2 Kommentare
flanker989
flanker989 am 18 Sep. 2021
That helped alot, thank you.
Star Strider
Star Strider am 18 Sep. 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by