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.

 채택된 답변

Chad Greene
Chad Greene 2014년 11월 11일
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.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

질문:

2014년 11월 11일

답변:

2014년 11월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by