Converting a linear equation to decibel

1 visualización (últimos 30 días)
flanker989
flanker989 el 18 de Sept. de 2021
Comentada: Star Strider el 18 de Sept. de 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.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by