Respondida
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...

casi 13 años hace | 0

| aceptada

Respondida
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...

casi 13 años hace | 0

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

casi 13 años hace | 0

Respondida
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....

casi 13 años hace | 1

Respondida
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...

casi 13 años hace | 0

Respondida
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...

casi 13 años hace | 4

| aceptada

Respondida
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...

alrededor de 13 años hace | 0

Respondida
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...

alrededor de 13 años hace | 0

Respondida
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...

alrededor de 13 años hace | 0

Respondida
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...

más de 13 años hace | 2

| aceptada

Respondida
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...

más de 13 años hace | 1

| aceptada

Respondida
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...

más de 13 años hace | 0

Respondida
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.

más de 13 años hace | 0

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

más de 13 años hace | 0

| aceptada

Respondida
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...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 2

| aceptada

Respondida
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...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 0

Respondida
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; ...

más de 13 años hace | 1

| aceptada

Respondida
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...

más de 13 años hace | 0

| aceptada

Respondida
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...

más de 13 años hace | 0

| aceptada

Respondida
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...

más de 13 años hace | 0

| aceptada

Respondida
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 ...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 2

Respondida
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...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 0

| aceptada

Respondida
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 ...

más de 13 años hace | 0

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

más de 13 años hace | 3

Respondida
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...

más de 13 años hace | 0

Cargar más