Finding x that approximate y to zero
5 ビュー (過去 30 日間)
古いコメントを表示
Abdullah Al-Alawi
2015 年 7 月 12 日
コメント済み: Abdullah Al-Alawi
2015 年 7 月 12 日
I am trying to find the the value x that make y approximately zero. Here is what I did:
e= 0.001 %error bar
for x = linspace(100, 170, 1000);
y = 18.9*log(x/170) +0.0042*(x-170) + 8.314*log(0.000267/0.0001413);
end
Thanks in advance.
0 件のコメント
採用された回答
Azzi Abdelmalek
2015 年 7 月 12 日
e= 0.01 %error bar
x = linspace(100, 170, 1000);
y = 18.9*log(x/170) +0.0042*(x-170) + 8.314*log(0.000267/0.0001413);
idx=find(abs(y)<e)
4 件のコメント
Azzi Abdelmalek
2015 年 7 月 12 日
If you are looking for the nearest value to 0.
e= 0.01 %error bar
x = linspace(100, 170, 1000);
y = 18.9*log(x/170) +0.0042*(x-170) + 8.314*log(0.000267/0.0001413);
[max_val,index_val]=min(abs(y))
その他の回答 (1 件)
Walter Roberson
2015 年 7 月 12 日
Consider
x0 = fzero( @(x) 18.9*log(x/170) +0.0042*(x-170) + 8.314*log(0.000267/0.0001413), [100, 170]);
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!