I'm trying to integrate the following function but without any luck

I'm trying to integrate the following function but without any luck
f(x)= ((A)/(2*pi))* atan( B*x^3+ C*x^2 +D *x)
I would also like to plot the results from x=[-3:3]
I'm a new user to Matlab. Could you please help?
Your help is greatly appreciated.

 Respuesta aceptada

First, define some x range over which to plot the function and integrate. Someone (your instructor?) has said the range should be from -3 to 3. You could simply use x = -3:3;, but then you'd only have seven points. Use smaller steps for higher resolution, e.g., x = -3:.1:3 if you want dx to equal 1/10.
Then define your function, call it y or fx or whatever you'd like. Your instructor has given you the function to integrate, so start by plotting the function so you can visualize it:
y = (A/(2*pi))*...
plot(x,y)
To integrate, think about what integration is. It's a sum over small steps. For a first attempt you could make a loop, and add up the parts of y for every little step. Then after you've gotten the right answer that way, you can look for more computationally-efficient ways to perform the integration.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 11 de Nov. de 2014

Respondida:

el 11 de Nov. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by