Convert function in Matlab into appropriate form -


i have written function feval takes 2 arguments , spits out number.

now wanted use command integral2 in order integrate on function feval(x,y).

the problem seems integral2 thinks have function can take 2 arrays arguments , apply pairwise operations on them. unfortunately, not case. function can works 2 numbers , not full arrays. there standard method make work?

actually, code , matlab claims q = integral2( @(x,y) arrayfun(func_cross_scat,x,y),0,2*pi,0,pi); function(feval, renamed func_cross_scat not enough input arguments)

feed integral2 not feval, feval_wrapper defined as

feval_wrapper = @(x,y) arrayfun(feval, x, y) 

x , y can arrays (of same size). works because arrayfun calls feval each pair of elements of input arrays x, y , gives array result.

as side comment, "feval" not name function, because matlab has built-in feval.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -