heat equation for infinite bar(rod)
2 views (last 30 days)
Show older comments
%Ecuatia caldurii pt bara infinita function ec_cald_bara_infin a=0;b=50;L=10;T=15;Ns=20;M=50;N=50;t=linspace(0,T,50); x=linspace(0,10,50); c=linspace(a,10,b); s=linspace(0,10,50); %calcul Y for n=1:N for m=1:M
Y=f(s).*exp(-( x(n)-s).^2/(4*a*a*t(m))); y=f(s); l=length(y) z=exp(-( x(n)-s).^2/(4*a*a*t(m))); p=length(z) D=Y.*z; r=length(c)
q=trapz(D,c);
%calcul u(t,n)
A=1/(2*a*sqrt(pi*t(m)));
w=length(A)
u(m,n)=A.*q;
end
end
figure(1) surf(t,x,u'); figure(2) for m=1:M plot(x,u(m,:))
axis([-L,L,min(min(u)), max(max(u))]);
film(m)=getframe; end movie(film,3,40); function f=f(s) f=s.*(L-s); end end
I tried figuring out this problem and all I managed to do is this code. Is it correct?
1 Comment
Torsten
on 9 Jan 2015
I see the code, but from the title of your request, I can't deduce the problem.
Best wishes
Torsten.
Answers (0)
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!