Discover How to Find and Evaluate the Integral of sinx in MatLab

In summary, to find the integral of sinx in MatLab, you can use the "int" function with "sin(x)" as the argument. This can be evaluated at specific values using the "subs" function and plotted using the "ezplot" function. The definite integral can also be found by specifying the limits of integration. The choice of limits will affect the value of the integral, but the indefinite integral will remain the same.
  • #1
Ali Asadullah
99
0
Please tell me the code or whatever we call it for finding the integral of sinx in MatLab?
Also how to evaluate definite integral from, say, 1 to 2?
 
Physics news on Phys.org
  • #2
syms x
fun=inline(sin(x))
int=quad(fun,1,2)
 

1. How do I find the integral of sinx in MatLab?

To find the integral of sinx in MatLab, you can use the built-in function "int" and specify "sin(x)" as the argument. This will return the indefinite integral of sinx, which can then be evaluated at specific values.

2. Can I evaluate the integral of sinx at specific values in MatLab?

Yes, you can evaluate the integral of sinx at specific values in MatLab by using the "subs" function. This function allows you to substitute a value for the variable in the integral expression and return the numerical result.

3. How do I plot the integral of sinx in MatLab?

To plot the integral of sinx in MatLab, you can use the "ezplot" function and specify "int(sin(x))" as the argument. This will plot the indefinite integral of sinx, which can then be further customized with labels and axes.

4. Can I find the definite integral of sinx in MatLab?

Yes, you can find the definite integral of sinx in MatLab by using the "int" function and specifying the limits of integration. For example, "int(sin(x), 0, pi)" will return the definite integral of sinx from 0 to pi.

5. Is the integral of sinx in MatLab affected by the choice of limits of integration?

Yes, the integral of sinx in MatLab is affected by the choice of limits of integration. Different limits will result in different values for the integral. However, the indefinite integral of sinx will remain the same regardless of the limits of integration.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
822
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
960
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
44
Views
5K
Back
Top