How can I measure value of points in matlab plot?
Afficher commentaires plus anciens
I have two data set. And I just need to determine 3dB Bandwidth. I want to locate value -4.01(Maximum is -1.01 and therefore this is the 3dB point on Y axis) on y axis and then corresponding x axis value. My code goes like this:
Insertion_loss = -1*[46.45,37.50,27.30,16.06,4.91,1.51,1.01,1.1,1.56,1.5,2.0,5.1,11.53,20.56,32.85,51.4];
Frequency= 1:0.2:4;
plot(Frequency, Insertion_loss)
xlabel('Frequency')
ylabel('Insertion Loss')
title('Frequency response of unknown filter')
1 commentaire
Walter Roberson
le 14 Fév 2016
Both of the -4.01 or just one of the two?
Réponses (1)
Image Analyst
le 14 Fév 2016
Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
Insertion_loss = -1*[46.45,37.50,27.30,16.06,4.91,1.51,1.01,1.1,1.56,1.5,2.0,5.1,11.53,20.56,32.85,51.4];
Frequency= 1:0.2:4;
plot(Frequency, Insertion_loss, 'bo-')
xlabel('Frequency', 'FontSize', fontSize)
ylabel('Insertion Loss', 'FontSize', fontSize)
title('Frequency response of unknown filter', 'FontSize', fontSize)
grid on;
xIndex = find(Insertion_loss > -4.01, 1, 'first');
f = Frequency(xIndex);
hold on;
plot(f, Insertion_loss(xIndex), 'b*');
% Draw lines to the curve.
xl = xlim();
yl = ylim();
line([f, f], [yl(1), Insertion_loss(xIndex)], 'Color', 'r', 'LineWidth', 2);
line([xl(1), f], [Insertion_loss(xIndex), Insertion_loss(xIndex)], 'Color', 'r', 'LineWidth', 2);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')

Catégories
En savoir plus sur Graphics Object Properties dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!