Integrate y=x/(exp(x)-1) in MATLAB

In summary: Just use the Trapzium rule to get the result you're after:>integral(@(x)x./(exp(x)-1),0,1)In summary, the problem appears to be that the user is trying to use the int() function to integrate a function with a variable on the left-hand side, but the int() function does not seem to be able to correctly calculate the result.
  • #1
leftbank007
2
0
Hi, I have a problem of integration in Matlab. I want to integrate the following equation:
y=x/(exp(x)-1)
and x is from 0 to 1.

I use int(y,0,1), but it seems that it does not give correct result.
Could you help me how to do it in Matlab? Thanks!
 
Physics news on Phys.org
  • #2
Try constructing the sum.
 
  • #3
Write your own integration routine. The use of Trapzium rule works very well in Matlab.
 
  • #4
>integral(@(x)x./(exp(x)-1),0,1)

This is how you integrate in Matlab. It is ridiculous to implement your own algorithm for anything other than educational purposes.
 
  • #5
It's good if the standard way is difficult implemented. I wrote all my own routines in matlab, even the Fourier transform bit.
 
  • #6
Quite a lot of effort goes into refining numerical methods. The optimization of your codes are without any doubt far inferior to what is already implemented by matlab. Also being able to learn the standard way to implement is a very crucial skill itself.
 
  • #7
True enough, but things like the Fourier transform, don't give the Fourier transform, they give something else, and if you have no idea what they're doing, then you might as well write your own and understand what is going on.

Don't get me wrong, there ARE a lot of routines that I trust MATLAB with without even thinking about writing myself, but some I just have no idea what is being done or the way that MATLAB implements it is impossible to code into your own routines.
 
  • #8
If there is some issue, as in this case, about the built-in approaches, then writing your own adds transparency and comparing different approaches can build confidence in a student.
Note: the question above is in an educational context: it is for educational purposes that this approach has been suggested.
Anyway - it's not difficult.
 

What is the function "Integrate y=x/(exp(x)-1)" used for?

The function "Integrate y=x/(exp(x)-1)" is used to calculate the definite integral of the equation y=x/(exp(x)-1) in MATLAB. This function is commonly used in mathematics and engineering to find the area under a curve.

How do I use the "Integrate y=x/(exp(x)-1)" function in MATLAB?

To use the "Integrate y=x/(exp(x)-1)" function in MATLAB, you first need to define the variables x and y, and then use the "integrate" function followed by the equation. For example, if you want to integrate the equation from 0 to 5, you would use the code "syms x y; int(y=x/(exp(x)-1), 0, 5)".

What is the output of the "Integrate y=x/(exp(x)-1)" function in MATLAB?

The output of the "Integrate y=x/(exp(x)-1)" function in MATLAB is the value of the definite integral of the equation. This value can be a decimal or symbolic expression, depending on the input values and the complexity of the equation.

Can the "Integrate y=x/(exp(x)-1)" function in MATLAB handle complex equations?

Yes, the "Integrate y=x/(exp(x)-1)" function in MATLAB can handle complex equations. However, the output may also be a complex number, so it is important to check the result carefully.

Are there any limitations to using the "Integrate y=x/(exp(x)-1)" function in MATLAB?

Yes, there are some limitations to using the "Integrate y=x/(exp(x)-1)" function in MATLAB. It may not be able to handle very large or complex equations, and the output may not be accurate if the function is unable to find a closed form solution for the integral.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
820
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
993
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
Back
Top