How to find specific x values of specific y value of a plotted graph?
17 views (last 30 days)
Show older comments
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));
0 Comments
Accepted Answer
KSSV
on 2 Jun 2021
Edited: KSSV
on 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 Comments
KSSV
on 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')
More Answers (0)
See Also
Categories
Find more on Discrete Data Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!