Area in shades region (Matlab)

  • Thread starter Thread starter gfd43tg
  • Start date Start date
  • Tags Tags
    Area Matlab
Click For Summary
SUMMARY

The discussion centers on calculating the area of a shaded region using MATLAB. The user inquires whether they can define a single function handle, fh = @(x) -0.1*x.^3 - 0.5*x.^2 - 2.2*x + 9, to represent the difference between two functions for integration. The consensus confirms that it is valid to express the shaded area as A_{shaded} = \int_{inter(2)}^{inter(3)} (f_{1}(x)-f_{2}(x)) \mathrm{d}x, leveraging the linearity of integrals.

PREREQUISITES
  • Understanding of MATLAB function handles
  • Knowledge of integral calculus, specifically properties of linearity
  • Familiarity with MATLAB syntax for defining anonymous functions
  • Basic skills in numerical integration techniques in MATLAB
NEXT STEPS
  • Explore MATLAB's integral function for numerical integration
  • Learn about defining and using anonymous functions in MATLAB
  • Study the properties of integrals, focusing on linearity and its applications
  • Investigate how to visualize shaded areas under curves in MATLAB plots
USEFUL FOR

Students and professionals in mathematics, engineers using MATLAB for simulations, and anyone interested in numerical methods for calculating areas under curves.

gfd43tg
Gold Member
Messages
949
Reaction score
48
ImageUploadedByPhysics Forums1407795886.518929.jpg

This is a part MATLAB and part math question. I know for the shaded region, I would usually do
##A_{shaded} = \int_{inter(2)}^{inter(3)} f_{1}(x) \mathrm{d}x - \int_{inter(2)}^{inter(3)} f_{2}(x) \mathrm{d}x##

However, since it appears they want the function handle to be just one line, am I allowed to do

Code:
fh = @(x) -0.1*x.^3 - 0.5*x.^2 - 2.2*x + 9

Since I can't make two integrals and just subtract them?

In other words, would it be correct to say
##A_{shaded} = \int_{inter(2)}^{inter(3)} (f_{1}(x)-f_{2}(x)) \mathrm{d}x##?
 
Last edited:
Physics news on Phys.org
Yes, of course, that's correct. One of the first things you should learn about integrals is that they are "linear": [tex]\int_a^b (\alpha f+ \beta g) dx= \alpha\int_a^b f dx+ \beta \int_a^b g dx[/tex]
 
Last edited by a moderator:
  • Like
Likes   Reactions: 1 person

Similar threads

Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 20 ·
Replies
20
Views
3K
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 105 ·
4
Replies
105
Views
11K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K