ecuacion del calor matlab vs octave
Publicado por wil (26 intervenciones) el 11/06/2020 02:10:12
Hola , el siguiente codigo esta correcto en matlab, pero al colocarlo en octave , no lo reconoce y no sale el grafico
y no se poruqe???
y no se poruqe???
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function w=heatfd(xl,xr,yb,yt,M,N)
D=1;
h=(xr-xl)/M;
k=(yt-yb)/N;
m=M-1;n=N;
sigma=(D*k)/(h*h);
% defino as funcoes
f=@(x) sin(2*pi*x).^2;
l=@(t) 0*t;
r=@(t) 0*t;
a=diag(1-2*sigma*ones(m,1))+diag(sigma*ones(m-1,1),1);
a=a+diag(sigma*ones(m-1,1),-1);
lside=l(yb+(0:n)*k);
rside=r(yb+(0:n)*k);
w(:,1)=f(xl+(1:m)*h)';
for j=1:n
w(:,j+1)=a*w(:,j)+sigma*[lside(j);zeros(m-2,1);rside(j)];
end
disp(' a solucao e=')
w=[lside;w;rside]
disp(' tamanho de w:')
size(w)
x=(0:m+1)*h;
t=(0:n)*k;
mesh(x,t,w');
view(60,30);axis([xl xr yb yt -1 1]);
end
Valora esta pregunta


0