MATLAB Matlab Problem: Integrating & Multiplying Functions w/o File

  • Thread starter Thread starter oby7842
  • Start date Start date
  • Tags Tags
    Function Matlab
AI Thread Summary
The discussion revolves around a user seeking assistance with integrating a function f(x) multiplied by another function g(x) without using a separate function file in MATLAB. The user attempted to use inline functions but encountered difficulties with multiplication and integration. Suggestions provided include using MATLAB's built-in functions 'int' for symbolic integration and 'diff' for differentiation. For numerical integration, the user is advised to consider 'trapz' or 'quad', while numerical differentiation can be performed using the formula for finite differences. There is a note on the benefits of using separate function files for better integration techniques and cleaner code organization.
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
Views
1K
Replies
1
Views
2K
Replies
4
Views
1K
Replies
5
Views
8K
Back
Top