Write Function/Integral equation

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 个)

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 个评论

Yes, but does it yield anything that makes sense? I.e., is finite?
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.

类别

在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by