Help with integral2 calculator

18 ビュー (過去 30 日間)
kd
kd 2018 年 4 月 21 日
コメント済み: Star Strider 2018 年 4 月 22 日
I'm trying to create a basic double integral calculator. How do I refine the code I have so far?
fun = @(x,y) input('enter integrand = ')
xmin = @(y) input('enter lower x boundary = ')
xmax = @(y) input('enter upper x boundary = ')
ymin = @(x) input('enter lower y boundary = ')
ymax = @(x) input('enter upper y boundary = ')
Q = integral2(fun,xmin,xmax,ymin,ymax)

採用された回答

Star Strider
Star Strider 2018 年 4 月 21 日

Use the str2func (link) function. I would also use vectorize (link):

fun = input('enter integrand = ', 's') 
fun = str2func(['@(x,y) ' vectorize(fun)])
Q = integral2(fun, xmin, xmax, ymin, ymax)
  3 件のコメント
kd
kd 2018 年 4 月 22 日
Thank you so much. You probably saved me 3 days of trial and error.
Star Strider
Star Strider 2018 年 4 月 22 日
As always, my pleasure!
This is an interesting problem.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by