Crank Nicolson Discretizacion Ecuacion de Difusion
Publicado por Roberto (11 intervenciones) el 22/11/2014 23:03:50
saludos! una pregunta
ojala alguien me pueda ayudar por favor
estoy discretizando esto pero tengo un error en el ultimo for
??? Error using ==> times
Matrix dimensions must agree.
Error in ==> Untitled2 at 39
Fi=(T.^k).*fi;
como lo puedo arreglar??? muchas gracias!
ojala alguien me pueda ayudar por favor
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
38
39
40
41
clc
clear all
%%
mu=0.1;
N=10;
h=1/N;
dt=0.01;
kmax=1000;
%matriz A
A=zeros(N,N);
for i=1:N
A(i,i)=-2;
end
A(1,1)=-1;
A(N,N)=-1;
%Diagonales inferior y Superior
for i=1:N-1
A(i,i+1)=1
end
for i=2:N
A(i,i-1)=1
end
%%
A=(mu/h^2)*A;
%condicion inicial
x=h/2:h:1-h/2;
fi=x.*(1-x);
%matriz T
T=inv(eye(N,N)-(dt/2)*A)*(eye(N,N)+(dt/2)*A);
%iteraciones
for k=1:kmax
Fi=(T.^k).*fi;
plot(Fi,x)
pause
end
estoy discretizando esto pero tengo un error en el ultimo for
??? Error using ==> times
Matrix dimensions must agree.
Error in ==> Untitled2 at 39
Fi=(T.^k).*fi;
como lo puedo arreglar??? muchas gracias!
Valora esta pregunta
0