回答済み
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...

13年弱 前 | 0

| 採用済み

回答済み
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...

13年弱 前 | 0

回答済み
Definite integral in (embedded) Matlab function
Use QUADGK, not QUAD.

13年弱 前 | 0

回答済み
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....

13年弱 前 | 1

回答済み
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...

13年弱 前 | 0

回答済み
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...

13年弱 前 | 4

| 採用済み

回答済み
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...

約13年 前 | 0

回答済み
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...

約13年 前 | 0

回答済み
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...

約13年 前 | 0

回答済み
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...

13年以上 前 | 2

| 採用済み

回答済み
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...

13年以上 前 | 1

| 採用済み

回答済み
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...

13年以上 前 | 0

回答済み
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.

13年以上 前 | 0

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

13年以上 前 | 0

| 採用済み

回答済み
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...

13年以上 前 | 0

回答済み
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...

13年以上 前 | 2

| 採用済み

回答済み
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...

13年以上 前 | 0

回答済み
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...

13年以上 前 | 0

回答済み
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; ...

13年以上 前 | 1

| 採用済み

回答済み
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...

13年以上 前 | 0

| 採用済み

回答済み
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...

13年以上 前 | 0

| 採用済み

回答済み
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...

13年以上 前 | 0

| 採用済み

回答済み
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 ...

13年以上 前 | 0

回答済み
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...

13年以上 前 | 2

回答済み
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...

13年以上 前 | 0

回答済み
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...

13年以上 前 | 0

回答済み
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...

13年以上 前 | 0

| 採用済み

回答済み
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 ...

13年以上 前 | 0

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

13年以上 前 | 3

回答済み
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...

13年以上 前 | 0

さらに読み込む