Numerical integration in matlab

i am very new in matlab. and i need to calculate the arc lengh. My equation is
arc length = integration of sqrt(d.*(k.^2-2).*sin(k.*t./2).^2 - d.*(k.^2-1).*sin(k.*t./2).^4 + 1); from 0 to 2.pi
where, d=(0:.1:1) and k=(0:1:10)

can anybody tell me whether it is possible to calculate this arc length using matlab. If possible can you suggest me the coding to write the script?

i am very new in matlab. and i need to calculate the arc lengh. My equation is
arc length = integration of sqrt(d.*(k.^2-2).*sin(k.*t./2).^2 - d.*(k.^2-1).*sin(k.*t./2).^4 + 1); from 0 to 2.pi
where, d=(0:.1:1) and k=(0:1:10)

can anybody tell me whether it is possible to calculate this arc length using matlab. If possible can you suggest me the coding to write the script?

thanks.

Welcome to PhysicsForums!

First off, are you integrating over k, or over t? Do you just want arclengths for different values of k?

Secondly, there are two ways of doing this: trapezoid rule, or with Simpson's rule.

i am integrating with repest to t. and yes i want arclength for different values of k as well as d.
for example: when d=.1, k=1:1:10, this will give me 10 different value of arclength.
when d=.2, k=1:1:10, this will again give me another 10 differenct value of arclength.
......................
......................
until d=1.

i have tried with the following to apply Z = trapz(X,Y).
>> x= 0:2*pi/100:2*pi;
>> k=(1:.1:10);
>> y=sqrt(1+0.1.*(k.^2-2).*sin(k.*x./2).^2-0.1.*(k.^2-1).*sin(k.*x./2).^4);
but this line give me an error msg.
??? Error using ==> times
Matrix dimensions must agree.

another problem is that i have fixed the value of d=.1 , as i do not know how to set the value of two variables at a time so that it gives me the results of arclength as my requirement(as i give an example in the beginning).

For each parameter configuration (there are 121 in your post = 11*11) this calculates the height of the curve you gave, from 0 to 2*pi in intervals of 0.01 (629 total calculations).

It then approximates the curve as a step function, or 629 different rectangles, and will therefore overestimate the area if the gradient is negative and underestimate the area if it is positive. It's a decent and simple first approximation.

Word of warning, this takes a long time.

area is an 11x11 double of your areas in parameter space. To see how it varies graphically,