I am having problems writing a complex function/integral. There are basically three inputs, X,Y,R and equations looks like this:
U(R) = R integral(0,Inf) X*Y sin(2piX*R)dx
and help?

回答 (2 件)

Star Strider
Star Strider 2016 年 5 月 11 日

0 投票

This runs:
Y = 1; % Assign Value
U = @(R) R .* integral(@(X) X .* Y .* sin(2*pi*X.*R), 0, Inf); % Function
R = 2; % Assign Value
Ur = U(R) % Call Function

2 件のコメント

John D'Errico
John D'Errico 2016 年 5 月 11 日
Yes, but does it yield anything that makes sense? I.e., is finite?
Star Strider
Star Strider 2016 年 5 月 11 日
It doesn’t when I run it.
This may be a ‘proxy problem’.

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

John D'Errico
John D'Errico 2016 年 5 月 11 日

0 投票

Well, since x and X are different variables, X*Y*sin(2*pi*X*R) is a constant. That means you have a constant integrated from 0 to +inf. The integral is infinite, with only the sign depending on the sign of that constant.
Oh. Maybe you really intend for X to be variable you will integrate over.
In that case, the integral is probably NaN (undefined). I can't be sure because your question is so vague.
Are Y and/or R functions of X? Or possibly x?
And of course, your question suggests that this is not the real problem, but something vaguely like it. Odds are, given that you have an infinite integral of an oscillatory function, the integral is NaN. Or maybe inf. Unless you want it to be 42, which is a number that some people like. I prefer 17.
If your problem is somehow different, and it actually has a finite solution, then you need to be less vague about the problem.

カテゴリ

質問済み:

2016 年 5 月 11 日

コメント済み:

2016 年 5 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by