why my dB plot doesn't seem right?

3 views (last 30 days)
Xiaolong wu
Xiaolong wu on 23 Nov 2020
Commented: Mathieu NOE on 24 Nov 2020
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 Comments
Xiaolong wu
Xiaolong wu on 24 Nov 2020
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 on 24 Nov 2020
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

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!