Answered
Why Matlab integral function does not work properly?
The problem is that "if" is not vectorized the way you would expect. I think if x > 0 means if all(x(:) > 0) S...

11 years ago | 3

Answered
Nested integral within integral2
The problem here is that integral2 requires that the integrand accept arrays as inputs and return arrays as outputs, but integra...

11 years ago | 2

| accepted

Answered
how to solve a integral when the parameters are matrix
I don't get the final assignment to x(t1) of what I presume to be a matrix result. Also, I am not certain whether e^A means exp...

11 years ago | 0

Answered
Integration HELP Mie Scattering
Since I don't know much about this application area, I'm not in position to work on the code here. I would approach a problem l...

11 years ago | 0

Answered
Why does strcmp take numerical arguments?
I think the intent was that the semantics of strcmp be ischar(a) && ischar(b) && strcmp(a,b) where in that expression i...

11 years ago | 1

| accepted

Answered
(Numerically) Integrating bump functions --- on R^1 vs R^2 and R^n
Avoid masking the integrand in this manner if possible. It is numerically toxic. INTEGRAL2 is written to accept functional lim...

11 years ago | 1

Answered
How can I declear a struct array in m file when generating C++ codes through Matlab Coder?
I would use repmat. Initially MATLAB Coder did not support empty struct arrays. Unfortunately, I don't remember when that restr...

11 years ago | 0

Answered
integral with (sin x)^4
You have two errors. One, you need 1./sqrt instead of 1/sqrt. Second, you have \0.0865^2 instead of /0.0865^2. Here is how to ...

11 years ago | 0

Answered
double integral and fitted functions
I'm going to treat this like a homework problem. You'll need to define some anonymous functions. For example, if b is a pp-form...

11 years ago | 0

Answered
MATLAB Coder indexing out of bounds
If x is a scalar passed to this function, then attempting to reference x(2) will error in MATLAB and in MATLAB Coder in exactly ...

11 years ago | 0

Answered
How to delete rows/columns of a matrix in Embedded Matlab Fcn?
I don't know what version you have. MATLAB Coder does currently support deleting rows and columns from a matrix. You will need...

11 years ago | 2

| accepted

Answered
Implementing generalized cosine and sine integrals
Well, first of all, I think we need 0 < k < 2 for the generalized sine integral and 0 < k < 1 for the generalized cosine integra...

11 years ago | 0

Answered
Porblem in Converting MATLAB code to C using MATLAB Coder
It sounds like you are supplying each of the functions to be compiled. If you do that, you will need to supply the argument typ...

11 years ago | 0

| accepted

Answered
How can I make definite integral to Bessel function in the interval from 0 to infinite
I'm not sure I understand the problem. The answer is 1, so use 1 instead of quadgk(f,0,inf). However, if you are concerned abou...

11 years ago | 0

Answered
Problem with quad: how to handle a loop in the integrand function ?
QUAD, and most of the other integration functions in MATLAB, is written to evaluate the integrand at more than one point at a ti...

11 years ago | 0

| accepted

Answered
Matlab Coder: how can I eliminate the date in c-code comments
I agree that this would be a useful thing. The only solution I know about is a "nuclear option". Under "Code Appearance" there...

11 years ago | 2

Answered
Using MATLAB, what is the best way to find the integral of a bounded range of a CDF?
Well, you _have_ the function as well, not just the vector. If I understand you correctly, integral(@(x)cdf(pd,x),r(1),r(2...

11 years ago | 2

| accepted

Answered
Is it possible to convert a global optimization matlab code, using multistart with lsqnonlin , in to c using codegen?
Unfortunately, no. LSQNONLIN is not supported for code generation. It is possible to use functions that are not supported with...

11 years ago | 0

Answered
How to perform 4D integral in matlab ?
The easiest way to integrate f(x,y,z,w) from a <= x <= b, c <= y <= d, e <= z <= g, and h <= w <= i is Q = integral(@(x)int...

11 years ago | 4

| accepted

Answered
How can I prevent the calculation of intermediary results while code generation with the embedded coder?
I think you have misapprehended the source of your problem. The exact mathematical result p1*p2*p3 is 1301.55464561. This numb...

11 years ago | 0

| accepted

Answered
Please help with the trig integral
On the line defining fun2, change "fun1" to "fun1(x)".

11 years ago | 0

Answered
Using Quad2d with indicator function
QUAD2D sends in m-by-m matrices, which you are required to evaluate "elementwise", i.e. if Z = f(X,Y), then Z is the same size a...

11 years ago | 0

Answered
Anonymous functions and integration
MATLAB files can be flexible when they are combined with the use of anonymous functions. Anonymous functions can also be suppli...

11 years ago | 1

Answered
dblquad integral strange behaviour
Since adaptive quadrature relies on finite sampling, and the number of initial points tends to be fixed, regardless of interval ...

11 years ago | 0

Answered
Getting Error using quad2d
Let f be the integrand function and let Z = f(X,Y). QUAD2D requires that # size(Z) matches size(X) and size(Y). The inputs ...

11 years ago | 0

Answered
numerical integration with nonarray function
It is, indeed, unnecessary to perform numerical integration on this integrand. However, to answer the question in _general_, Th...

11 years ago | 0

| accepted

Answered
How to know starting which MATLAB release a particular function was implemented?
INTEGRAL was added in R2012a along with INTEGRAL2 and INTEGRAL3.

11 years ago | 0

Answered
How can i evaluate this surface integral? (It has some singularities)
When I split the integral up into regions with difficult parts (a couple of circles) on the boundaries, I can get QUAD2D and INT...

11 years ago | 0

Answered
Integral2 and array valued functions
Not in the same way. INTEGRAL2 does not support an 'ArrayValued' option. I prototyped it, but testing revealed that it did not...

11 years ago | 2

| accepted

Answered
how to improve accuracy of double integral (i.e. quad2d, iterated integral-quadgk twice) when variables are close to zero?
Perhaps the difference here is just that you are missing the area in the square [0,.001]x[0,.001]. It would be easier to look i...

11 years ago | 0

| accepted

Load more