how to add x^0 or y^0 variable in the function(dblquad)!!

1 view (last 30 days)
i have question about how to automatic add x^0 in a3 for every item.Because i must need dblquad.when i use the command without add x^0 by hand .it will error!!
but actually i have a lot of things like a3 without x variable or y variable so i need help.
What command can automatic add x or y variable.
a3=((2*y)/3 - 1)^2*(5085106975559725/144115188075855872 + 3243695640608965i/18446744073709551616)
b3=matlabFunction(a3)
c3=dblquad(b3,-1,1-1,1)% it will error beacuse no x^0 so any one have good ideal about it

Answers (1)

Star Strider
Star Strider on 20 Apr 2015
Your anonymous function ‘b3’ is a function of one variable. The MATLAB double integration functions want it to be a function of two variables. If you want to integrate it across ‘x’ as well, you would have to do something like this:
syms y x
a3=((2*y)/3 - 1)^2*(5085106975559725/144115188075855872 + 3243695640608965i/18446744073709551616)
c3 = vpa(int(int(a3, y, -1, 1), x, -1, 1), 10)
produces:
c3 =
0.1620497113 + 0.0008075665013i
Experiment to get the result you want.
  2 Comments
Star Strider
Star Strider on 20 Apr 2015
The int function is in the Symbolic Math Toolbox.
The dblquad function will not work with your single-variable function ‘c3’.

Sign in to comment.

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!