Convolution of Two Functions

2 visualizaciones (últimos 30 días)
jgillis16
jgillis16 el 28 de Jul. de 2015
Comentada: Torsten el 29 de Jul. de 2015
I need to implement a function that is:
G(T) = integral(-inf,inf)[Y1(W1)*W1(X1+T)]dt
Code drafted so far is:
%fun = @ (Y1,X1,W1,XX1) Y1(X1).*W1(XX1);
%q = integral(fun, -inf, inf);
(where XX1 = X1 + 0.0001)
But, I keep getting the error message below:
Error using @(Y1,X1,W1,XX1)Y1(X1).*W1(XX1)
Not enough input arguments.
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 103)
[q,errbnd] = vadapt(@minusInfToInfInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in s27onepointone (line 73)
q = integral(fun, -inf, inf);
Any suggestions on how to proceed?

Respuestas (2)

Torsten
Torsten el 28 de Jul. de 2015
G(T) = integral(-inf,inf)[Y1(W1)*W1(X1+T)]dt
makes no sense.
W1 is an independent variable in Y1(W1) and becomes a dependent variable in W1(X1+T).
The integration variable is t which does not appear in Y1(W1)*W1(X1+T).
Do you want to calculate the convolution of two functions ?
Best wishes
Torsten.
  1 comentario
jgillis16
jgillis16 el 28 de Jul. de 2015
Apologies. Yes, a convolution would be precisely what I would be looking for as I need an integral that expresses the amount of overlap of one function g as it is shifted over another function f. The limits set were just basic limits I noted on an abstract note.

Iniciar sesión para comentar.


Steven Lord
Steven Lord el 28 de Jul. de 2015
The function you specify as the first input to the INTEGRAL function must accept 1 input vector. Your function accepts (indeed REQUIRES) 4 inputs. See the description of the fun input argument in that documentation page for more information.
Please be more specific about the mathematical problem you're trying to solve (describe what the various identifiers you're using in your code represent -- function, variable, etc.) If you do that you may be able to receive more guidance about how to perform the integration you want.
  2 comentarios
jgillis16
jgillis16 el 28 de Jul. de 2015
Editada: jgillis16 el 28 de Jul. de 2015
The original integral I have is:
G(tau) = integral(-inf, inf) h_x(t)*h_+(t+tau)dt
where tau = T, h_x = Y1, h_+ = W1, and t = X1.
And: T = 0.0001, Y1 = 55488x1 double, W1 = 55488x1 double, X1 = 55488x1 double.
I will need to perform a convolution of the two given functions as I need to identify the overlap between two functions.
Hope this is clear enough.
Torsten
Torsten el 29 de Jul. de 2015
If your X1 vector is ordered, use the trapezoidal rule to evaluate the integral:
G(tau) = (Y1(t1)*W1(t1+tau)+Y1(t2)*W1(t2+tau))/2 * (t2-t1) +
(Y1(t2)*W1(t2+tau)+Y1(t3)*W1(t3+tau))/2 * (t3-t2) + ...+
(Y1(t55487)*W1(t55487+tau)+Y1(t55488)*W1(t55488+tau))/2 * (t55488-t55487)
To get W1(ti+tau), you will have to use interpolation.
Best wishes
Torsten.

Iniciar sesión para comentar.

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by