How to find specific x values of specific y value of a plotted graph?
19 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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 个评论
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!