Community Profile

Numerical Analyst

Top 1% contributor

Compute Multiple Integrals of Orders 4, 5, and 6

25 downloads

1 year ago

Since this is a piecewise polynomial function, you can use mkpp to create a pp structure to use with ppval. Note the adjustment...

2441 views

Responded 2 years ago

QUAD2D accepts function handles for limits. Take care that you make them "vectorized" (usually just use .*, .+, and ./ instead ...

accepted

4

Answered 4 years ago

Using your later example, idivide(a,4,'floor') does what you want there. I prefer to make both arguments integers of the s...

That is the error you get when you use coder.extrinsic and fail to declare the output before calling the extrinsic function. If...

3

I don't see where you checked any of the answers in a valid way. To check MATLAB's answer, you severely rounded it first and th...

2

Answered 1 year ago

If you don't need to generate code for your model, I think you can use your second approach, but you need to fix a few unrelated...

I'm assuming this is homework. Let me give you a couple of hints. 1. You can make a function like this q = @(b)integral...

I try not to do too many homework problems here because in a former life I was a college professor, and I think it's bad for the...

MATLAB added a new built-in function called ishermitian in 2014a. Apparently you have one of your own on the path. Type "which...

So if your function g works with a scalar value of c, then you need to vectorize it. You'll have the same problem if you do som...

First define a function. This function must be able to accept an array and return an array. That is to say, if y1 = f(x1) and ...

The INTEGRAL2 interface is set up to calculate an iterated integral where the integral over the second argument of the integrand...

This bl = @(ln1, ln2) bl+pro; is syntactically wrong. The operation + is not defined on function handles. You need to...

Well, the short answer is don't use QUAD for anything anymore. Here's why. # INTEGRAL supports mixed relative and absolute er...

Answered 3 years ago

Add coder.extrinsic('Addi_mex'); to the top of your MATLAB function, and I think it will work in MATLAB. Basically, t...

First, regarding QUADV in particular, the MATLAB Function Block supports QUADGK. You may find that it is competetive to call QU...

I don't know. Since I work in code generation, these sorts of behaviors are a regular nuisance to me, but maybe I can imagine w...

The problem here is that ROOTS always returns a variable-size result. That's because it ignores leading zeros (or extremely sma...

You need to tell the compiler what the output of lqr will look like. Kr = zeros(1,2); % Define the output type for the extr...

1

Answered 6 months ago

Something like this? psf = @(x,y,z)exp(-2*(x.^2+y.^2)-2*z.^2); fun1 = @(k,e,x,y,z)((e.*psf(x,y,z)).^k).*exp(-e.*psf(x,y,...

Answered 9 months ago

The iterated mode uses adaptive quadrature in each dimension, though your integrand function will, in a sense, be aware of only ...

Answered 10 months ago

Could you try this and tell me what values of m, s, and n lead to unexpected results? I added some waypoints near the center of...

Answered 12 months ago

Well, you can try integralN from the file exchange. I wrote that little ditty just so I wouldn't have to keep explaining the nu...

If you were to evaluate f(g(x),b), then MATLAB would first calculate y = g(x) and then evaluate f(y,b). Your main problem here ...

You can use INT if your problem can be handled symbolically. If not, numerical integration of a 5-fold integral in MATLAB requi...

The problem is that out1 is a symbolic "thing", not a MATLAB "thing". That's what the error message is really telling you. You...

QUADL is obsolete. You haven't supplied any values for k0 and L. Please provide just one value for each of the following input...

I'm not sure if there is supposed to be a relationship between the t intervals and rho, or whether the fact that there are 15 ro...

Except when computing array-valued integrals, the INTEGRAL function requires that the integrand function be coded to accept _arr...

Load more

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend you select United States from the following list:

See all countries