Simple solution to a simple problem
1 view (last 30 days)
Show older comments
Hey, Im trying to write an algorithm to compute the integral of a user inputted function with limits. I wrote the following code:
When i run the code i get the following error: ??? Error using ==> inlineeval at 15 Error in inline expression ==> 1/(1+9*x.^2) Matrix dimensions must agree.
Error in ==> inline.subsref at 27 INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ==> Simpson38 at 9 Ib=(h*3/9)*(2*sum(func(4:3:(N-2)))); What could be the problem?
Richard Brown on 14 Jun 2013
1./(1 + 9*x.^2)
i.e. a '.' before the division
Richard Brown on 16 Jun 2013
Great! Please "accept" the answer so people browsing the forum knows it's been answered
Find more on Mathematics 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!