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.

카테고리

도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기

질문:

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