Matlab help with this simple integration

Click For Summary
SUMMARY

This discussion focuses on performing numerical integration in MATLAB, specifically using the trapezoid rule for values of xaf ranging from 0 to 1 in increments of 0.1. The user seeks guidance on how to implement this integration and plot the results as xaf versus theta. Key MATLAB commands provided include defining a vector with the syntax x=0:0.1:1; and performing element-wise operations with y=x.^2;. The discussion emphasizes the importance of MATLAB's documentation for beginners.

PREREQUISITES
  • Basic understanding of MATLAB syntax and commands
  • Familiarity with numerical integration techniques, such as the trapezoid rule
  • Knowledge of vector operations in MATLAB
  • Ability to create plots in MATLAB
NEXT STEPS
  • Explore MATLAB's documentation on numerical integration techniques
  • Learn about MATLAB's plotting functions for visualizing data
  • Study element-wise operations in MATLAB for efficient data manipulation
  • Research advanced numerical methods for integration beyond the trapezoid rule
USEFUL FOR

Beginner MATLAB users, students learning numerical methods, and anyone interested in data visualization and integration techniques in MATLAB.

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: 434
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:

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K