Matlab help with this simple integration

AI Thread Summary
The discussion centers on a request for assistance with integrating and plotting values in MATLAB, specifically for xaf values ranging from 0 to 1 in 0.1 increments. Users are encouraged to learn how to perform the integration using numerical techniques like the trapezoid rule. While the forum does not provide direct answers to homework questions, it offers guidance on using MATLAB's documentation for beginners. A sample code snippet is provided to help define the vector and perform element-wise operations. Overall, the conversation emphasizes learning and understanding MATLAB rather than simply obtaining solutions.
ILW
Messages
1
Reaction score
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: 417
Physics news on Phys.org
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:
Back
Top