フィルターのクリア

Unable to use the sqrt(A) function in a function file

3 ビュー (過去 30 日間)
John Doe
John Doe 2014 年 2 月 22 日
コメント済み: John Doe 2014 年 2 月 22 日
I'm trying to execute a function similar to this:
function y=y(w)
a=1
b=1
c=1
d=1
e=1
f=(b*c)*a^3
F = @(x) x^2+sin(x/2)
funct = sqrt(5)+sqrt(F)
I have more code after this but I get an error before this section shown below
Undefined function 'sqrt' for input arguments of type
'function_handle'.
Error in y (line 9)
funct = sqrt(5)+sqrt(F)
Can someone help me with what to do here? Ive tried changing the sqrt to ^0.5 or ^1/2 but it still won't work.

採用された回答

Dishant Arora
Dishant Arora 2014 年 2 月 22 日
F is your function handle ,how could you pass it as parameter to sqrt?? Probably,you want to do this:
sqrt(F(5));

その他の回答 (0 件)

カテゴリ

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

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by