Está en la página 1de 8

ECUACIN DE CALOR

PROBLEMA 1
clear
close all
syms n x t
l=1;
k=5;
h=(-x^2)+2*x
Bn = (2/l)*(int(h*(sin((n*pi*x)/l))));
Arm = 20;
for n=1:Arm
f(n,:) = sum (exp (k*((-t)*pi^2*n^2))* sin(n*pi*x) *Bn)
end
disp (sum(f))
x = linspace(0, 0.1, 2);
t = linspace(0, 0.1, 1);
[x,t] = meshgrid(x,t);
Ut= subs(sum(f),'x',x);
disp (Ut);
Usubt = (sum(Ut));
subplot(2,2,4),ezplot(Usubt,[0,0.04,]);
title ('x vs f(t)');
Ux= subs(sum(f),'t',t);
disp (Ux);
Usubx = (sum(Ux));
subplot(2,2,2),ezplot(Usubx,[0,1]);
title ('t vs f(x)');
U = simple(sum(f));
subplot(2,2,[1 3]), ezsurf(U,[0 ,0.05,0.2,0.5]);
title ('Diagrama U(x,t) ');
hold on;

PROBLEMA 2
clc
clear
close all
syms n x t
h= x^2+2*x
l=1;
A0 = (1/l)(int(h,x,0,l));
An = ((sin(n*pi/2)/(n*pi))-(2/((n^2)*pi^2))+(2*(-1^n)/(n^2*pi^2)));
K= 1;
Bn = 0;
long = 10;
for n=1:long
f(n,:) = (sum (((sin(n*pi/2)/(n*pi))-(2/((n^2)*pi^2))+(2*(-1^n)/
(n^2*pi^2))) *exp(-2*t*pi^2*n^2)* cos(n*pi*x) ) ) ;
end
disp (sum(f))
x = linspace(0, 0.5, 1);
t = linspace(0,0.1, 1);
%[x,t] = meshgrid(x,t);
Ut= subs(sum(f),'x',x);
disp (Ut)
Usubt = (sum(Ut));
subplot(2,2,4),ezplot(Usubt,[0,0.1]);
title ('X vs f(t)');
Ux= subs(sum(f),'t',t);
disp (Ux)
Usubx = (sum(Ux));
subplot(2,2,2),ezplot(Usubx,[0,2]);
title ('t vs f(x)');
U = simple(sum(f));
subplot(2,2,[1 3]), ezsurf(U,[0 ,0.01,0.25,0.5]);
title ('diagrama expansion');
hold on;

PROBLEMA 3
close all
syms n x t
k=1;
a=1;
h=x^2+2*x
A0 = 0;
An = ((4*sin(n*pi/2)-n*pi*cos(n*pi/2)+n*pi*(-1^n))/((pi^2)*n^2) );
l=1;
Bn = ((-2*(-1^n))/(n*pi));
a=1;
long = 10;
for n=1:long
f(n,:) = sum ((((4*sin(n*pi/2)-n*pi*cos(n*pi/2)+n*pi*(-1^n))/
((pi^2)*n^2) )*cos(n*pi*t)+((-2*(-1^n))/
(n*pi))*sin(n*pi*t))*sin(n*pi*x))
;
end
disp (sum(f))
x = linspace(0, 0.1, 1);
t = linspace(0, 1, 10);
%[x,t] = meshgrid(x,t);
Ut= subs(sum(f),'x',x);
disp (Ut);
Usubt = (sum(Ut));
subplot(2,2,4),ezplot(Usubt,[0.04,0.45]);
title ('x vs f(t)');
Ux= subs(sum(f),'t',t);
disp (Ux);
Usubx = (sum(Ux));
subplot(2,2,2),ezplot(Usubx,[0,1]);
title ('t vs f(x)');
U = simple(sum(f));
subplot(2,2,[1 3]), ezsurf(U,[0 ,0.4,0.35,1]);
title ('diagrama');
hold on;

PROBLEMA 4
clc
clear
close all
syms n x t
k=1;
a=1;
qn=(B^2-n^2)^1/2
An = 2/pi((2*sin(n*pi/2)-n*pi*cos(n*pi/2)+n*pi*(-1^n))/((pi^2)*n^2) );
l=1;
B = ((-2*(-1^n))/(n*pi));
a=1;
long = 10;
for n=1:long
f(n,:) = sum ((((4*sin(n*pi/2)-n*pi*cos(n*pi/2)+n*pi*(-1^n))/
((pi^2)*n^2) )*cos(n*pi*t)+((-2*(-1^n))/
(n*pi))*sin(n*pi*t))*sin(n*pi*x))
;
end
disp (sum(f))
x = linspace(0, 0.1, 1);
t = linspace(0, 1, 10);
%[x,t] = meshgrid(x,t);
Ut= subs(sum(f),'x',x);
disp (Ut);
Usubt = (sum(Ut));
subplot(2,2,4),ezplot(Usubt,[0.04,0.45]);
title ('x vs f(t)');
Ux= subs(sum(f),'t',t);
disp (Ux);
Usubx = (sum(Ux));
subplot(2,2,2),ezplot(Usubx,[0,1]);
title ('t vs f(x)');
U = simple(sum(f));
subplot(2,2,[1 3]), ezsurf(U,[0 ,0.4,0.35,1]);
title ('diagrama');
hold on;

PROBLEMA 5
clc
clear
close all
syms n x y
a= 2;
b=2;
n=10
hh= (4*x)+3;
A0 = 1/(a*b)*int(hh,0,a) ;
An = (2/(a*sinh((n*pi*b)/a)))*int(hh*cos(n*pi*x/a),0,a);
B= 1;
l=pi;
Bn = 0;
long = 10;
for n=1:long
f(n,:) = A0*y + sum(An*sinh(n*pi*y/a)*cos(n*pi*x/a)) ;
end
disp (f)
x = linspace(0,0.1,5);
y = linspace(0.8,1,5);
for h=1:length(y)
Fx = sum(subs(f, 'y', y(h)));
subplot(2, 2, 4),plot(x, subs(Fx, 'x', x), 'Color', rand(1,3),
'Linewidth', 2);
hold on;
legend(num2str(y));
end
hold on; grid on; box on
xlabel('x');
title('En funcion de "x" para distintos "y"')
for h=1:length(x)
Fy = sum(subs(f, 'x', x(h)));
subplot(2,2,2),plot(y, subs(Fy, 'y', y), 'Color', rand(1, 3),
'Linewidth', 2);
hold on;
legend(num2str(x));
end

hold on; grid on; box on


title('En funcion de "y" para distintos "x"')
xlabel('y');
U = simple(sum(f));
subplot(2,2,[1 3]), ezsurf(U,[0,0.15,0,0.1]);
title ('diagrama');
hold on;

PROBLEMA 6
clc

clear
close all
syms n x y
a= 2;
b=2;
n=10
hh= (4*x)+3;
A0 = 1/(a*b)*int(hh,0,a) ;
An = (2/(a*sinh((n*pi*b)/a)))*int(hh*cos(n*pi*x/a),0,a);
B= 1;
l=pi;
Bn = 0;
long = 10;
for n=1:long
f(n,:) = A0*y + sum(An*sinh(n*pi*y/a)*cos(n*pi*x/a)) ;
end
disp (f)
x = linspace(0,0.1,5);
y = linspace(0.8,1,5);
for h=1:length(y)
Fx = sum(subs(f, 'y', y(h)));
subplot(2, 2, 4),plot(x, subs(Fx, 'x', x), 'Color', rand(1,3),
'Linewidth', 2);
hold on;
legend(num2str(y));
end
hold on; grid on; box on
xlabel('x');
title('En funcion de "x" para distintos "y"')
for h=1:length(x)
Fy = sum(subs(f, 'x', x(h)));
subplot(2,2,2),plot(y, subs(Fy, 'y', y), 'Color', rand(1, 3),
'Linewidth', 2);
hold on;
legend(num2str(x));
end
hold on; grid on; box on

title('En funcion de "y" para distintos "x"')


xlabel('y');
U = simple(sum(f));
subplot(2,2,[1 3]), ezsurf(U,[0,0.15,0,0.1]);
title ('diagrama');
hold on;

También podría gustarte