Converting a linear equation to decibel

조회 수: 2 (최근 30일)
flanker989
flanker989 2021년 9월 18일
댓글: Star Strider 2021년 9월 18일
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.

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by