Matlab help with this simple integration

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
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: 439
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: