Current location - Training Enrollment Network - Mathematics courses - Matlab software and mathematical experiment
Matlab software and mathematical experiment
f? =? @(x)(sin( 1.006*x)。 ^2);

Format? Dragon;

m? =? [ 100,200, 1000];

For what? i= 1:3

The% interval is divided into n equal eldest son intervals.

n? =? M (1);

xn? =? (0:n- 1)/n * pi; ? %xn(i) is the value of the left end point of the I-segment interval.

d? =? pi/n; ? % subinterval width

xnm? =? xn+d/2; ? The midpoint of the% interval

ynm? =? f(xnm); ? Function value of midpoint in% interval

S(i)? =? Sum (ynm); ? % sum

end

Average percentage

Smirne? =? Sum (S)/ sum (m)? % function average

% solution equation

x? =? fsolve(@(x)? sin( 1.006*x)^2-smean,0. 1)