Matlab Problem: Integrating & Multiplying Functions w/o File

In summary, the person is seeking suggestions for integrating a function from 0 to a and multiplying it with another function without using another function file. They have tried using an inline function command but it did not work. They are open to both symbolic and numerical methods, but express a preference for not using another function file. They also mention that using a separate function file can make the job easier and cleaner.
  • #1
oby7842
11
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
  • #2
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:

[tex]\frac{\Delta x}{\Delta y} = \frac{x_{i+1} - x_{i}}{y_{i+1} - y{i}}


[/tex]
 
  • #3
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.
 

1. What is Matlab?

Matlab is a programming language and numerical computing environment commonly used in scientific and engineering applications. It allows users to manipulate and analyze data, create visualizations, and perform complex mathematical operations.

2. How do I integrate a function in Matlab?

To integrate a function in Matlab, you can use the "integral" function. This function takes in the function you want to integrate as well as the limits of integration and returns the numerical value of the integral.

3. Can I multiply functions in Matlab without using a file?

Yes, you can multiply functions in Matlab without using a file. The ".*" operator can be used to multiply two arrays element-wise, which can be used to multiply two functions represented as arrays of values.

4. Is it possible to integrate and multiply functions in Matlab without using loops?

Yes, it is possible to integrate and multiply functions in Matlab without using loops. The "integral" and ".*" functions mentioned earlier are designed to work with arrays, eliminating the need for loops.

5. How accurate are the results of integrating and multiplying functions in Matlab?

The accuracy of the results in Matlab depends on various factors, such as the complexity of the function, the limits of integration, and the numerical methods used. Generally, Matlab provides highly accurate results for numerical computations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
992
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
858
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
8
Views
466
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
Back
Top