フィルターのクリア

i want to write a code where equation is y=x*x. if y=100 what is the value of x?

3 ビュー (過去 30 日間)
i have written
z=100;
for x=1:1:20
y=x*x
if y==z
fprintf(x)
end
end

採用された回答

Stephen23
Stephen23 2020 年 9 月 18 日
編集済み: Stephen23 2020 年 9 月 18 日
>> f = @(x) x.^2 - 100;
>> x = fzero(f,pi)
x = 10
  3 件のコメント
Stephen23
Stephen23 2020 年 9 月 18 日
編集済み: Stephen23 2020 年 9 月 18 日
This
@(x) x.^2 - 100
defines an anonymous function:
fzero uses that function to find the zero crossing (i.e. the input value for which the function output is zero).
rakesh kumar
rakesh kumar 2020 年 9 月 18 日
Ok,thanks a lot

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

その他の回答 (1 件)

KSSV
KSSV 2020 年 9 月 18 日
z = 100 ;
x = 1:20 ;
y = x.^2 ;
y(x==z)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by