フィルターのクリア

call an equation within the function

3 ビュー (過去 30 日間)
Soumili Sen
Soumili Sen 2020 年 10 月 27 日
コメント済み: Soumili Sen 2020 年 10 月 27 日
hello,
I am writing a code like,
syms x y;
data=2*x^2+3*x+y;
function f= obj(x,y)
f=@data;
end
but here 'f' is not calling the equation 'data' within the function. what will be the command so that 'f' can call the data in this function?
  2 件のコメント
David Hill
David Hill 2020 年 10 月 27 日
What are you trying to do? Please explain with an example. Is there a reason you need symbolic variables?
Soumili Sen
Soumili Sen 2020 年 10 月 27 日
basically I am tring to call an equation (data) in the function so I can further proceed . symbolic variables is not necessary,I am taking this one to declare the equation

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

採用された回答

David Hill
David Hill 2020 年 10 月 27 日
You can pass the data function to your other function. Not sure this helps. I still don't know exactly what you are trying to do.
data=@(x,y)2*x.^2+3*x+y;
function f = obj(x,y,data)
f=data(x,y);
end
  1 件のコメント
Soumili Sen
Soumili Sen 2020 年 10 月 27 日
thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by