Write Function/Integral equation
Afficher commentaires plus anciens
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?
Réponses (2)
Star Strider
le 11 Mai 2016
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 commentaires
John D'Errico
le 11 Mai 2016
Yes, but does it yield anything that makes sense? I.e., is finite?
Star Strider
le 11 Mai 2016
It doesn’t when I run it.
This may be a ‘proxy problem’.
John D'Errico
le 11 Mai 2016
0 votes
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.
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!