Substitution problem of function from one variable to another variable

6 ビュー (過去 30 日間)
Kien Tah Goh
Kien Tah Goh 2015 年 2 月 16 日
コメント済み: Kien Tah Goh 2015 年 2 月 16 日
Hey guys, thanks for your valuable time to take a look at this problem
I am quite new in MATLAB, so please forgive me for silly question, thanks a lot =))
Problem:
I got a function x and y, ie f(x,y) = x+y+1
Now I need to use matlab to help me sub x to become i and y to become j, ie f(x,y)-->f(i,j)==i+j+1
Is that possible to use command 'subs' or any other solutions for this problem?
Thanks in advanced !!!

採用された回答

Stephen23
Stephen23 2015 年 2 月 16 日
First define your function:
>> fun = @(x,y) x+y+1;
Now call the function with any values that you like:
>> fun(1,2)
ans = 4
You can even pass variables to it:
>> a = 3;
>> b = 2;
>> fun(a,b)
ans = 6
  1 件のコメント
Kien Tah Goh
Kien Tah Goh 2015 年 2 月 16 日
Thank you Stephen Cobeldick~~thanks for helping~ have a nice day =))

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by