MATLAB Answers

How to do integration of this equation and plot graph between T and y

조회 수: 3(최근 30일)
Aayush Meena
Aayush Meena 2021년 7월 3일
댓글: Alan Stevens 2021년 7월 8일
Here
variables are t' and n only
u=0.020;
x=0.025;
y=(0:0.0001:0.010); we have to vary y
z=0;
t=5;
neta= 0.6;
P=200;
C=500;
l=0.008;
Alpha=17e-6;
ro= 1000;
r=sqrt((x-(u*(5-t)))^2+y^2);

채택된 답변

Alan Stevens
Alan Stevens 2021년 7월 3일
Like this perhaps:
u=0.020;
x=0.025;
z=0;
t=5;
eta= 0.6;
P=200;
C=500;
ro= 1000;
l=0.008;
Alpha=17e-6;
r = 0.01; % Guessed value as you haven't specified r
k = eta*P/(pi*ro*C*l);
y= (0:0.001:0.010);
DT = zeros(1,numel(y));
for i = 1:numel(y)
f1 = @(tp) (4*Alpha*(t-tp)+r^2).^-1;
f2 = @(tp) exp(-((x - u*(t-tp)).^2+y(i).^2).*f1(tp));
DeltaTfn = @(tp) f1(tp).*f2(tp).*(1 + 2*f3(tp)); % You set z to zero, so the cosine term is jusr 1
DT(i) = k*integral(DeltaTfn,0,t);
end
plot(y,DT),grid
xlabel('y'), ylabel('\Delta T')
disp(DT(numel(y)))
40.3366
function s = f3(tp)
t = 5;
Alpha=17e-6;
l=0.008;
s = 0;
nmax = 10; % Adjust this until you get convergence
for n=1:nmax
s=exp(-Alpha*n^2*pi^2*(t-tp)/l^2) + s;
end
end
  댓글 수: 4
Alan Stevens
Alan Stevens 2021년 7월 7일
Like this:
u=0.020;
x=0.025;
z=0:0.0002:0.002;
t=5;
eta= 0.6;
P=200;
C=500;
ro= 1000;
l=0.008;
Alpha=17e-6;
r = 0.01; % Guessed value as you haven't specified r
k = eta*P/(pi*ro*C*l);
y= 0.005; %(0:0.001:0.010); Arbitrary constant - use your own value
DT = zeros(1,numel(z));
for i = 1:numel(z) %%%%%%%%%% y goes to z
f1 = @(tp) (4*Alpha*(t-tp)+r^2).^-1;
f2 = @(tp) exp(-((x - u*(t-tp)).^2+y.^2).*f1(tp)); %%%%%%% take the (i) off y
DeltaTfn = @(tp) f1(tp).*f2(tp).*(1 + 2*f3(tp,z(i))); % pass z(i) to function f3
DT(i) = k*integral(DeltaTfn,0,t);
end
plot(z,DT),grid
xlabel('z'), ylabel('\Delta T')
disp(DT(numel(z)))
58.9313
function s = f3(tp,z) %%%%%%%
t = 5;
Alpha=17e-6;
l=0.008;
s = 0;
nmax = 10; % Adjust this until you get convergence
for n=1:nmax
s=exp(-Alpha*n^2*pi^2*(t-tp)/l^2)*cos(n*pi*z/l) + s; %%%%%%%
end
end

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

추가 답변(1개)

Aayush Meena
Aayush Meena 2021년 7월 8일
What if we vary x(x=0:0.0001:0.050) and take y and z as constants.
Thanks
  댓글 수: 1
Alan Stevens
Alan Stevens 2021년 7월 8일
Like so:
u=0.020;
x=0:0.0001:0.050; %%%%%%%%%%%%%
z=0.002; %%%%%%%%%%%%%
t=5;
eta= 0.6;
P=200;
C=500;
ro= 1000;
l=0.008;
Alpha=17e-6;
r = 0.01; % Guessed value as you haven't specified r
k = eta*P/(pi*ro*C*l);
y= 0.005; %(0:0.001:0.010); Arbitrary constant - use your own value
DT = zeros(1,numel(x));
for i = 1:numel(x) %%%%%%%%%% y goes to z
f1 = @(tp) (4*Alpha*(t-tp)+r^2).^-1;
f2 = @(tp) exp(-((x(i) - u*(t-tp)).^2+y.^2).*f1(tp));
DeltaTfn = @(tp) f1(tp).*f2(tp).*(1 + 2*f3(tp,z)); % pass z to function f3
DT(i) = k*integral(DeltaTfn,0,t);
end
plot(x,DT),grid
xlabel('x'), ylabel('\Delta T')
disp(DT(numel(x)))
46.9846
function s = f3(tp,z) %%%%%%%
t = 5;
Alpha=17e-6;
l=0.008;
s = 0;
nmax = 10; % Adjust this until you get convergence
for n=1:nmax
s=exp(-Alpha*n^2*pi^2*(t-tp)/l^2)*cos(n*pi*z/l) + s; %%%%%%%
end
end
That's pretty much every combination of x, y and z dealt with now!

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

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by