How to find specific x values of specific y value of a plotted graph?

28 Ansichten (letzte 30 Tage)
Hi I am plotting a transfer function magnitude with respect to omega. I am trying to find cut off frequencies which are the 1/sqrt(2) values of magnitude plot. So in summary I want to find x values which f(x)= 1/sqrt(2) in the graph I plotted. And if possible I want to emphasize them (by marking, crossing etc.)
I tried to find intersection point between line y=1/sqrt(2) But couldn't find a precise result as well so a follow up question. Can I find the points which 2+ plot intersected ?
Here is my code and graph
y = linspace(0,50000,50001);
R=33*10^3;
C=10^-8;
H = @(y) (R./(R-(1j./(y.*C))));
figure;
subplot(2,1,1);
plot(y,abs(H(y)));
xlabel('\omega');
ylabel('|H(j\omega)|');
hold on;
yline(1/sqrt(2));

Akzeptierte Antwort

KSSV
KSSV am 2 Jun. 2021
Bearbeitet: KSSV am 2 Jun. 2021
y = linspace(0,50000,50001); % y values
R=33*10^3; % constant
C=10^-8; % constant
H = @(y) (R./(R-(1j./(y.*C)))); % function
val = abs(H(y)) ; % evaluate absolute function H values at y
vali = 1/sqrt(2) ; % the value of val (y-axes) at which y (x-axes_ to be sought
yi = interp1(val,y,vali) ; % do interpolation to get respective y-value ofr given vali
figure;
plot(y,val);
xlabel('\omega');
ylabel('|H(j\omega)|');
hold on;
yline(1/sqrt(2));
plot(yi,vali,'*r')
  4 Kommentare
Utku Deniz Altiok
Utku Deniz Altiok am 2 Jun. 2021
Is there any more simpler method than interpolation? since its not a concept I am familiar with
KSSV
KSSV am 2 Jun. 2021
y = linspace(0,50000,50001); % y values
R=33*10^3; % constant
C=10^-8; % constant
H = @(y) (R./(R-(1j./(y.*C)))); % function
val = abs(H(y)) ; % evaluate absolute function H values at y
vali = 1/sqrt(2) ; % the value of val (y-axes) at which y (x-axes_ to be sought
yi = y(abs(val-vali)<10^-3) ; % Get the index in val where val == vali
figure;
plot(y,val);
xlabel('\omega');
ylabel('|H(j\omega)|');
hold on;
yline(1/sqrt(2));
plot(yi,vali,'*r')

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by