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

조회 수: 26 (최근 30일)
Utku Deniz Altiok
Utku Deniz Altiok 2021년 6월 2일
댓글: KSSV 2021년 6월 2일
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));

채택된 답변

KSSV
KSSV 2021년 6월 2일
편집: KSSV 2021년 6월 2일
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
Utku Deniz Altiok
Utku Deniz Altiok 2021년 6월 2일
Is there any more simpler method than interpolation? since its not a concept I am familiar with
KSSV
KSSV 2021년 6월 2일
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')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by