Azzera filtri
Azzera filtri

Add a decade plots to graph

10 visualizzazioni (ultimi 30 giorni)
monkey_matlab
monkey_matlab il 2 Set 2015
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.

Risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by