Answered
dblquad works weird: as the ranges increase, the integral value decreases
I guess this question has sat here awhile. I just stumbled on it during a search. The reason is that adaptive quadrature works...

ongeveer 11 jaar ago | 0

Answered
Definite integral in (embedded) Matlab function
Use QUADGK, not QUAD.

ongeveer 11 jaar ago | 0

Answered
double integral with one indefined variable
I don't know what bessel0 is, so I just substituted atan() below, but this the way you would do that with numerical integration....

ongeveer 11 jaar ago | 1

Answered
How can I get rid of type-punned pointer warnings in my MATLAB coder generated C code?
I don't know how to change that generated code by manipulating options. However, you might be able to rewrite it and avoid havi...

ongeveer 11 jaar ago | 0

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

ongeveer 11 jaar ago | 4

| accepted

Answered
Calculating double integral of a single variable
Three ways: integral2(@(x,y)f(x).*g(x,y),E1,E2,E1,@(x)x) integral(@(x)f(x).*integral(@(y)g(x,y),E1,x),E1,E2,'ArrayValued...

ongeveer 11 jaar ago | 0

Answered
parameterized function of quadgk with another array input argument
The virtues of avoiding loops in MATLAB are sometimes clear, sometimes unclear. QUADGK is a heavily vectorized integrator desig...

meer dan 11 jaar ago | 0

Answered
I have a function which is like f(a,x). I want to numerically integrate it with respect to x, for example using quad function and get factor a in the output. Can someone share how can I achieve this?
Having *a* in the output implies symbolic integration, not numerical. I don't know your use case, but possibly you would find i...

meer dan 11 jaar ago | 0

Answered
Equivalent of #define's for matlab coder?
Unfortunately, no, there is no way to do this, and it is quite a bit more complex a suggestion than it may seem at first because...

meer dan 11 jaar ago | 2

| accepted

Answered
I have this code for Runge Kutta method and keep showing error "index must be a positive interger " please I need help
Suppose you have the (mathematical) function f(x,y) = 0.5 - x + 2*y. To define this function in MATLAB you can _either_ write a...

meer dan 11 jaar ago | 1

| accepted

Answered
m code transformed into c code accounterd errors
I am a little confused. From the way you ask the question, we would think that that you were just using MATLAB normally and thi...

meer dan 11 jaar ago | 0

Answered
How to make integral of Hankel function at infinite?
Use INTEGRAL. If you don't have R2012a or later, use QUADGK. If you don't have QUADGK, it's time to upgrade.

meer dan 11 jaar ago | 0

Answered
How to evaluate multiple definite integrals using the integral(F,min,max) function?
L = arrayfun(@(a,b)integral(F,a,b),dmin,dmax)

meer dan 11 jaar ago | 0

| accepted

Answered
Interpolation of 3D scattered data to 3D graph in Simulink
What version of MATLAB are you using? This will help me figure out what to do. Note that the function griddata3 no longer exists...

meer dan 11 jaar ago | 0

Answered
Generating C/C++ Code from M-Function include MEX-File
Add coder.extrinsic('Addi_mex'); to the top of your MATLAB function, and I think it will work in MATLAB. Basically, t...

meer dan 11 jaar ago | 2

| accepted

Answered
C/ C++ compiler for embedded MatLab function
That should work. I'm assuming you've verified that the compiler is installed correctly and works separately from MATLAB or Sim...

meer dan 11 jaar ago | 0

Answered
calculating the integration, arrayfun problem???
I'm not sure what type of mathematical problem you are trying to express and solve. If you have a function f(x) which returns a...

meer dan 11 jaar ago | 0

Answered
Numerically integrate a function f(x) over x using MATLAB where f(x) has another argument y which is a vector
If you have R2012a, integral(@(x)sum(exp(-0.5*(x-y))),x0,x1,'ArrayValued',true) For example, >> y = 0:0.5:4; ...

meer dan 11 jaar ago | 1

| accepted

Answered
need to use double quad function for four integration with four unknowns
You should be using INTEGRAL2, but the solution is almost the same. Using INTEGRAL2: integral2(@(u,v)arrayfun(@(z,w)inte...

meer dan 11 jaar ago | 0

| accepted

Answered
Facing problem with Double integral of function P=f(u,v) for -∞<u<∞ and -∞<v<∞ & y=0:5:90;
QUAD2D requires an integrand function f(x,y) that operates element-wise on input matrices. So f([1,2;3,4],[5,6;7,8]) must evalu...

meer dan 11 jaar ago | 0

| accepted

Answered
Codegen and the "find" Function
Try tmp = find(etc.); location(i) = tmp(1); However, FIND is pretty heavyweight for this. I prefer to write little h...

meer dan 11 jaar ago | 0

| accepted

Answered
Why am I getting an error " Function 'isfixed' is not defined for a first argument of class double." while integrating in a matlab function block in simulink.
I was not even aware of this "int" function. Apparently it is deprecated and you are now supposed to use storedInteger(), or I ...

meer dan 11 jaar ago | 0

Answered
problem with function output in the embedded matlab function
This error means that you are trying to return the value from an extrinsic function call without having told the compiler what t...

meer dan 11 jaar ago | 2

Answered
For loop relative to the quad function to apply integration, which is faster?
I'm afraid I don't fully understand the question, but if you need to do a surface integral, use integral2. If you don't have R2...

meer dan 11 jaar ago | 0

Answered
Evaluating integral numerically using quadgk
Make sure that you are using elementwise operations. See the first / in fct? It should be ./ instead. Check all the other mul...

meer dan 11 jaar ago | 0

Answered
Marginal Density from a joint DIstribution
You might try to do it symbolically with INT. Numerically, you could do this: fx = @(t)arrayfun(@(x)integral(@(y)f(x,y),-i...

meer dan 11 jaar ago | 0

| accepted

Answered
Initialising variables in an embedded function
Right. The output variable cannot be a persistent variable. There's more than one way to go about this, but all involve using ...

meer dan 11 jaar ago | 0

Answered
Olympic puzzle number one
# builtin('clear','clear') # You can delete the variable from the workspace window (highlight and press delete or right click...

meer dan 11 jaar ago | 3

Answered
Avoiding inverse of a matrix
We usually write A\B instead of inv(A)*B. So if you're computing D - C*inv(A)*B, then write it D - C*(A\B). It's hard to predi...

meer dan 11 jaar ago | 0

Answered
error using unique function
What type of data is in the cell array? When you use UNIQUE on a cell array, the only case that's supported is when the element...

meer dan 11 jaar ago | 0

| accepted

Load more