How do I integrate this expression?

I have an expression for force here:
f =1.3e7*((500*y).*(0.46775*cos(60*t+0.2094395101999999e6*x)+0.37843*cos(2*(60*t+0.2094395101999999e6*x))+0.25228*cos(3*(60*t+0.2094395101999999e6*x))+0.1169*cos(4*(60*t+0.2094395101999999e6*x)))/1);
I need to integrate this expression w.r.t y and x (double integral), keeping t fixed.
Any idea how I could do this?

답변 (1개)

Walter Roberson
Walter Roberson 2012년 11월 15일

0 개 추천

That expression is numeric GIGO (Garbage In, Garbage Out). You have 1.3e7 which is only two decimal places of precision, but you also have 0.2094395101999999e6 which is 16 decimal places ending in 999999 that looks like blindly copied floating point numbers that should have been rounded.
But anyhow. Letting the limits be y0 and y1, and x0 and x1, the integral is
(5021948750/3848451) * (y0+y1) * ((140325/25228) * sin(60*t + (10262536/49) * x0) + (113529/50456) * sin(120*t + (20525072/49) * x0) + sin(180*t + (30787608/49) * x0) + (2505/7208) * sin(240*t + (41050144/49) * x0) - (140325/25228) * sin(60*t + (10262536/49) * x1) - (113529/50456) * sin(120*t + (20525072/49) * x1) - sin(180*t + (30787608/49) * x1) - (2505/7208) * sin(240*t + (41050144/49) * x1)) * (y0-y1)
Choose the number of digits of precision wisely when you convert to floating point.

댓글 수: 4

Yagnaseni Roy
Yagnaseni Roy 2012년 11월 15일
I found the functions dblquad and triplequad for the integration and used them successfully for small and simple functions however for the function I put above,I get the error 'Maximum function count exceeded, Singularity likely'.....Walter Roberson, your solution didn't seem to work out.
Walter Roberson
Walter Roberson 2012년 11월 15일
What integration bounds are you testing with?
When I test over y=0..3, x=1..7, and then plot over t=0..Pi/15, the difference I get between the above expression (with fractions) and the integral of the floating point version, is fairly obviously due to numeric round off differences caused by propagation of the low number of digits of precision. The graph of the integral is completely periodic either way.
If you were trying to integrate to infinity you would have problems with the integral, as limit(sin(x), x->infinity) is undefined.
Yagnaseni Roy
Yagnaseni Roy 2012년 11월 16일
Pls forgive me if this is a very obvious question, but how did you get this formula for integration? I mean just by looking at it, the coefficients are not the same as in the expression I put up. Anyway, I got it to work.
Walter Roberson
Walter Roberson 2012년 11월 16일
I used Maple. The coefficients are the same as you used, just expressed as rational numbers.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

질문:

2012년 11월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by