Matlab help with this simple integration

In summary, the conversation is about someone asking for help on how to integrate and evaluate values in MATLAB. They also request assistance in plotting a specific graph and mention being a beginner in the program. The person responding mentions not doing homework for others, but offers some guidance and suggests using the trapezoid rule or other numerical techniques. They also provide a sample code to help with the task.
  • #1
ILW
1
0
Hi,
I am very new to Matlab. I need help with how to do this (Please see the attached pic) on Matlab. xaf values go from 0 to 1 with 0.1 increments. (It need to be integrated and then evaluated at these values of xaf.) It would be much better if you can show me to plot xaf vs theta. An m file guide would be appreciated.
Sorry if the question is too easy but I just can't find it on the web.
Thanks in advance.
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    3.6 KB · Views: 398
Physics news on Phys.org
  • #2
Welcome to PhysicsForums!

We don't do homework (or stuff that looks like homework) for you here, although we're quite delighted to help you through things (like Jerry Maguire says, "Help [us], help you!"

Are you familiar with how you'd do this by hand using the trapezoid rule or other numerical technique?

If you're very new to MATLAB, Mathworks makes very good documentation that helps you get up and running:
http://www.mathworks.com/help/techdoc/learn_matlab/bqr_2pl.html

I'll throw you a bit of a bone however:
Code:
x=0:0.1:1;	%defines vector of values between 0 and 1, in 0.1 increments
y=x.^2;	%squares each one of the values in the x-vector: note the dot (.) operator usually indicates element-wise operations:

For that last bit on element-wise vs. regular operators, see:
http://www.mathworks.com/help/techdoc/matlab_prog/f0-40063.html
 
Last edited by a moderator:

FAQ: Matlab help with this simple integration

What is Matlab and how can it help with integration?

Matlab is a programming language commonly used in scientific and engineering applications. It has built-in functions for numerical integration, making it a useful tool for solving complex integration problems.

How do I use Matlab to perform integration?

To perform integration in Matlab, you can use the built-in function integrate(). This function takes in the function to be integrated and the limits of integration as inputs, and returns the value of the integral.

Can Matlab handle both definite and indefinite integrals?

Yes, Matlab can handle both definite and indefinite integrals. For definite integrals, you need to specify the limits of integration. For indefinite integrals, the output will be a symbolic expression.

Are there any other functions in Matlab that can help with integration?

Yes, there are several other built-in functions in Matlab that can help with integration, such as trapz() for numerical integration using the trapezoidal rule, and quad() for adaptive quadrature integration.

Can I use Matlab to plot the results of integration?

Yes, Matlab has powerful plotting capabilities that allow you to visualize the results of integration. You can use the plot() function to plot the integrated function, or use area() to create an area plot of the integration result.

Similar threads

Replies
10
Views
2K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
6
Views
1K
Replies
7
Views
3K
Replies
1
Views
4K
Back
Top