Converting a linear equation to decibel

2 vues (au cours des 30 derniers jours)
flanker989
flanker989 le 18 Sep 2021
Commenté : Star Strider le 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.

Réponse acceptée

Star Strider
Star Strider le 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 commentaires
flanker989
flanker989 le 18 Sep 2021
That helped alot, thank you.
Star Strider
Star Strider le 18 Sep 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by