Convolution of Two Functions

2 ビュー (過去 30 日間)
jgillis16
jgillis16 2015 年 7 月 28 日
コメント済み: Torsten 2015 年 7 月 29 日
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?

回答 (2 件)

Torsten
Torsten 2015 年 7 月 28 日
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 件のコメント
jgillis16
jgillis16 2015 年 7 月 28 日
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.

サインインしてコメントする。


Steven Lord
Steven Lord 2015 年 7 月 28 日
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 件のコメント
jgillis16
jgillis16 2015 年 7 月 28 日
編集済み: jgillis16 2015 年 7 月 28 日
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 2015 年 7 月 29 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by