Matlab Problem: Integrating & Multiplying Functions w/o File

  • Context: MATLAB 
  • Thread starter Thread starter oby7842
  • Start date Start date
  • Tags Tags
    Function Matlab
Click For Summary
SUMMARY

The discussion centers on integrating and multiplying functions in MATLAB without using separate function files. The user, Omar Bin Yusuf, seeks assistance with integrating a function f(x) from 0 to a and multiplying it with another function g(x). Key suggestions include using the 'int' and 'diff' functions for symbolic operations, and 'trapz' or 'quad' for numerical integration. The conversation highlights the importance of using separate function files for cleaner and more efficient coding practices in MATLAB.

PREREQUISITES
  • Familiarity with MATLAB syntax and environment
  • Understanding of symbolic mathematics in MATLAB
  • Knowledge of numerical integration techniques
  • Basic concepts of differentiation
NEXT STEPS
  • Explore MATLAB's 'int' function for symbolic integration
  • Learn about the 'diff' function for symbolic differentiation
  • Investigate numerical integration methods using 'trapz' and 'quad'
  • Understand the advantages of using separate function files in MATLAB
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those involved in mathematical modeling, numerical analysis, and anyone looking to enhance their coding practices in MATLAB without relying on multiple function files.

oby7842
Messages
9
Reaction score
0
hellow everyone, its my first post. In my problem i have a function f=f(x)... inned to integrate it from 0 to a ...I need to multiply f with some other function g(x) and differentiate it...i don't want to use another function file...i tried inline function command but it can't multiply with g(x) and integrate it...

I need some suggestion badly. Thanks

omar Bin Yusuf
 
Physics news on Phys.org
For symbolic integration and differentiation look into the functions 'int' and 'diff'.

To do this numerically, look into 'trapz' or 'quad' to integrate. Numerical differentiation is simply:

\frac{\Delta x}{\Delta y} = \frac{x_{i+1} - x_{i}}{y_{i+1} - y{i}}<br /> <br /> <br />
 
oby7842 said:
i don't want to use another function file

Any specific reasons for this ? there is a reason MATLAB asks for separate file for better integration techniques and besides it makes job easier and cleaner.

Regards.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
9K