Problem to solve this integral in matlab

In summary, the conversation is about someone seeking help to solve an integral in MATLAB. The integral involves a function and has given an error when attempted to be solved. The person is asking for assistance and apologizes for their writing. Another person suggests trying a simpler integral to use with MATLAB.
  • #1
hore69
1
0
hello , somebody could help me to solve in MATLAB this integral?
[tex]r(\alpha) =\frac{1}{\theta} \int_{0}^{\theta} \ e^{-jk*2Rsin(\sigma/2)sin(\sigma/2+\alpha) } \,d\sigma[/tex]
I have tried to solve it but it gives this error :confused: :

Warning: Explicit integral could not be found.
> In C:\MATLAB6p5\toolbox\symbolic\@sym\int.m at line 58
In C:\MATLAB6p5\work\directividadCurvado.m at line 12
? Error: Assignment statements do not produce results. (Use == to test
for equality.)

Error in ==> C:\MATLAB6p5\toolbox\symbolic\@sym\double.m
On line 45 ==> D = reshape(eval(X),m,n);

Error in ==> C:\MATLAB6p5\work\directividadCurvado.m
On line 12 ==> ppp=double(int(exp(-i*k*2*R*sin(x/2).*(sin(x/2)+t)),'x','0','ang'));

please help me. Excuse me by my writing. Thanks. :smile:
 
Physics news on Phys.org
  • #2
U can't solve it. Try Matlab with a simpler integral

[tex] \int e^{\sin x} \ dx [/tex]

Daniel.
 
  • #3


Hi there, solving integrals in MATLAB can sometimes be tricky. Without seeing your specific code, it's difficult to pinpoint the exact issue. However, there are a few things you can try to solve this integral.

First, check your syntax to make sure it is correct. It looks like you may have a typo in your code, as the error message is saying that the assignment statement does not produce results.

Next, try using the "syms" function before defining your integral. This will tell MATLAB to treat the variable as a symbolic variable, which can help with solving integrals.

You can also try using the "int" function instead of "double(int)", as this may give you more accurate results.

If you are still having trouble, you can try breaking the integral into smaller pieces and solving them separately. This may make it easier for MATLAB to find a solution.

Lastly, if none of these solutions work, you may need to use a different method for solving the integral, such as numerical integration.

I hope this helps and good luck!
 

What is the integral function in Matlab?

The integral function in Matlab is used to calculate the definite integral of a given function over a specified interval. It can also be used to calculate the indefinite integral of a function.

How do I input a function into the integral function in Matlab?

To input a function into the integral function in Matlab, you can use the following syntax: integral(@(x) f(x), a, b), where f(x) is your function and a and b are the limits of integration.

What is the difference between definite and indefinite integrals in Matlab?

A definite integral in Matlab calculates the numerical value of the integral over a specific interval, while an indefinite integral calculates the antiderivative of the function.

How can I solve a multidimensional integral in Matlab?

To solve a multidimensional integral in Matlab, you can use the integral2 or integral3 functions, depending on the number of dimensions. These functions allow you to specify the limits of integration in each dimension.

Are there any common errors encountered when using the integral function in Matlab?

One common error when using the integral function in Matlab is the "integral must return a scalar" error. This can occur if the function being integrated does not return a single value for a given input. To fix this, make sure your function is properly defined to return a scalar.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
Back
Top