Integration Value is x’ N = the number of half triangles N>5 N is a whole number
ID: 3283542 • Letter: I
Question
Integration Value is x’
N = the number of half triangles
N>5
N is a whole number
h and l are the dimensions of the triangles
Write a matlab program that solves the integral numerically and gives the temperature in 3 different positions. Use the method of Simpsons 1/3 Method
The values needed are not given and can be chosen
nl dx (n-1)l 2n (-1)n -1 h + (z)2 Notar que la variable de integración es x', n es el número de semi-dientes que la generación de calor, h y l son las dimensiones del semi-diente (ver figura), x, y, z son las coordenadas en donde se desea hallar la temperatura. n5 Heating source 1 ( in nununo entnoExplanation / Answer
ANSWER:
Sample Code:
%%%This is the function we will use
%%%it gives the value of the approximate integral
%%of a function f from a to b using N intervals
%Save this function as compositerectangle.m
%This must be in the same directory as the script
function sum=compositerectangle(f,a,b,N)
H=(b-a)/N;
sum=0;
for i=0:(N-1)
sum=sum+H*feval(f,a+i*H);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%This is the SCRIPT
%Here you can change the values
x=2;
y=3;
z=1;
h=2;
l=2;
n=10;
%We create the function (instead of x' we call the variable t)
f=@(t)(1./(sqrt((x-t).^2 + (y-((-1).^(n+1)).*((h./l).*t-((2.*n+((-1).^n)-1)./2).*h)).^2 + z.^2)));
a=(n-1).*l;
b=n.*l;
%%%We use the function compositerectangle.m we've created (it must be in
%the same location as the SCRIPT)
%Here we use 10000 intervals
N=10000;
integral=compositerectangle(f,a,b,N);
fprintf('The integral is %.12f',integral)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.