フィルターのクリア

How to evaluate the x value corresponding to an y value from a plotted y(x)?

2 ビュー (過去 30 日間)
Agent Cooper
Agent Cooper 2012 年 10 月 1 日
I am trying to evaluate the x value corresponding to an y value, after plotting y(x). How can I do that for any kind of values? I used the find function, but it fails. I attached the code lines below:
% parameters
mu0 = pi*4e-7;
M = 1.3e5;
R = 0.5e-6;
H = 0.67e-6;
d = [1e-6:1e-7:1e-5];
% function definition
format long;
F = (1./4)*(pi*mu0*M^2*R^4)*(1./d.^2+1./(d+2*H).^2-2./(d+H).^2);
% plot F(d)
plot(d,F,'green', 'LineWidth', 2);
% evaluating the x of an y (the d value corresponding to an F)
index = find(F == 1e-10)
d_coresp = d(index)

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 1 日
編集済み: Azzi Abdelmalek 2012 年 10 月 1 日
Dont use
index = find(F == 1e-10)
use
eror=1e-11
[~,idx]=find(abs(F-1e-10)> eror
% eror depends on how many samples you are using and on the variation of F
your are not sur 1e-10 belongs to your plot
  4 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 2 日
編集済み: Azzi Abdelmalek 2012 年 10 月 2 日
Ok I missed one ) .
eror=1e-11
[idx,~]=find(abs(F-1e-10)> eror)
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 2 日
[idx,~] instead of [~,idx]

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by