Add a decade plots to graph

25 次查看(过去 30 天)
monkey_matlab
monkey_matlab 2015-9-2
From the attached simulated data file, I wanted to add decade plots as follows:
  1. 30 dB per decade from 100 to 3000
  2. 20 dB per decade from 3000 to 1000000
  3. Horizontal line from 1000000 to 40000000
Here is my code for the original data file:
% Select file
clear;
clc;
[FileName,PathName] = uigetfile('*.txt','Select data file');
fid = fopen( strcat(PathName,FileName) ,'rt' );
% Read the file and store into matrix v
i = 0;
v = [0 0];
while feof(fid) == 0
buffer = fscanf(fid, '%f', 2);
buffer = buffer';
if i == 0;
v = buffer;
else
v = vertcat(v,buffer);
end
i = i + 1;
end
% Frequency vector
freq = v(:,1);
% Phase noise vector
pnoise = v(:,2);
figure
semilogx(freq,pnoise); grid on; axis([100 40^5 -160 -70]);
title('Simulated Phase Noise');
xlabel('Offset Frequency (Hz)'); ylabel('Phase Noise (dBc/Hz)');
return
My end plot should look something like:
How do I go about doing this?
Thanks.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by