Maximizing the fraction of two integrals using matlab

In summary, the individual is seeking help with maximizing a problem in MATLAB. They have tried using Mathematica but it cannot handle the problem. They have defined the necessary functions in MATLAB but do not know how to proceed. They are suggested to use a parameter for a and plot the results to find the maximum value. The maximum value is found to be 0.
  • #1
Verdict
117
0
EDIT:
I left out something of major importance, I want to maximize with respect to a!

Good day,

I've run into an issue in solving a certain problem with matlab, and I was hoping if anyone could help me out. I am relatively new to matlab, so I don't even know if this is possible, but I figured that in principle it should be.

What I want to do is maximize

integrals.jpg


for positive values of a.
With the calculus I know, I can't evaluate these integrals, so I have no applicable formula's so I am pretty stuck at this point. I tried using mathematica, and although it can evaluate the integrals, it cannot maximize the fraction. So instead I figured I should use MATLAB (which I also have to my disposal) to do so instead, but I simply don't know how. I don't get much further than defining the integrals, as
fun1 = @(x) x.^2./(exp(x)-1);
fun2 = @(x) x.^3./(exp(x)-1);

Could anyone help me out?

Kind regards
 
Last edited:
Physics news on Phys.org
  • #2
Given the Mathematica can solve the integrals - then just use a as a parameter and plot the ratio for a running from 0 to 100 by steps of 1 - and look at the plot.

Mathematica will be a better tool for this type of work than Matlab.
 
  • #3
That's not true at all, MATLAB can handle problems like this just fine.

1. Define the functions. You got this part already.

Code:
fun1 = @(x) x.^2./(exp(x)-1);
fun2 = @(x) x.^3./(exp(x)-1);

2. Define the function with a parameter.

Code:
q = @(a) integral(fun1,a,Inf)./integral(fun2,a,Inf);

3. Plot the results and read the maximum off the plot.

Code:
for j=0:100
    Q(j+1) = q(j);
end
plot(0:100,Q)

The answer is 0, which is rather intuitive when you think about it.
 

Attachments

  • plot.png
    plot.png
    1.3 KB · Views: 487

FAQ: Maximizing the fraction of two integrals using matlab

How can I use Matlab to maximize the fraction of two integrals?

To maximize the fraction of two integrals using Matlab, you can use the "fmincon" function. This function allows you to specify the objective function (in this case, the fraction of two integrals) and any constraints, and it will find the optimal solution.

What is the benefit of maximizing the fraction of two integrals?

Maximizing the fraction of two integrals can help you find the most efficient way to allocate resources or optimize a process. This can save time, money, and resources in various scientific fields.

Can I use any type of integrals in this process?

Yes, you can use any type of integrals as long as they can be expressed as a mathematical function. However, it is important to ensure that the integrals are well-defined and have a finite value.

Is there any specific method for solving this problem in Matlab?

Yes, there are multiple methods you can use to solve this problem in Matlab, including gradient descent, interior-point, and sequential quadratic programming. It is recommended to try different methods and compare their results to find the most accurate solution.

Are there any limitations to using Matlab for maximizing the fraction of two integrals?

While Matlab is a powerful tool for scientific computing, it does have some limitations. It is important to ensure that the problem is well-posed and that the integrals can be accurately evaluated. In addition, Matlab may have difficulty with highly nonlinear or discontinuous functions.

Similar threads

Replies
5
Views
2K
Replies
32
Views
3K
Replies
1
Views
2K
Replies
10
Views
2K
Replies
8
Views
2K
Replies
7
Views
1K
Back
Top