why my dB plot doesn't seem right?

2 次查看(过去 30 天)
Xiaolong wu
Xiaolong wu 2020-11-23
评论: Mathieu NOE 2020-11-24
Dear, I have a very simple signal, now I want to plot it. It seems all make sense when I plot it use linear scale. But I got very strange plot when I plot in log scale. code below:
%% test data
fs = 1000;
t = 0:1/fs:5-1/fs;
x = cos(2*pi*50*t)+cos(2*pi*100*t);
%plot(t,x)
%plotChannelSpectral(x);
[psd,f] = pwelch(x,500,200,500,1000);
plot(f,(psd)); % this one makes sense
figure;
plot(f,10*log10(psd)); %this just doesn't make sense
Should it be strght line?
And I don't know when should I use log scale and when should I use linear. For this instance, linear is very good, but log is not.
Thanks in advance.
  5 个评论
Xiaolong wu
Xiaolong wu 2020-11-24
Thanks, I will try the bode plot definitely.
How am I supose to accept the answer, I remember there is a accept answer button?
Mathieu NOE
Mathieu NOE 2020-11-24
Make sure you are logged in.
If the question has already been closed you will see "Accepted Answer by ____" to the right of your profile picture where the question is asked. If not, then look next to the profile picture of the answerer(s). To the right of each person's answer, in green, you should see a box that says "Accept this answer." Push that button

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by