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

6 Ansichten (letzte 30 Tage)
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);

Akzeptierte Antwort

Alan Stevens
Alan Stevens am 3 Jul. 2021
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 Kommentare
Aayush Meena
Aayush Meena am 7 Jul. 2021
If we want to take x and y as constant and vary z from 0 to 0.002 in the first code(when we take r= 0.01). Then how can we do that.
PLEASE REPLY AND THANKS.
Alan Stevens
Alan Stevens am 7 Jul. 2021
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Aayush Meena
Aayush Meena am 8 Jul. 2021
What if we vary x(x=0:0.0001:0.050) and take y and z as constants.
Thanks
  1 Kommentar
Alan Stevens
Alan Stevens am 8 Jul. 2021
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!

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by