Rozwiązanie równania metodą różnic skończonych

0

Witam, mam prośbę bop chce rozwiazać równanie v(x,y)=6xy(1-y)-2x^3 dla 0<=x<=1
dla warunków brzegowych : dla x=0 alfa=1, beta 1=0 i gamma1=0, natomiast dla x=1 alfa2=1, beta2=0 i gamma2=y(1-y)
metodą róznic skończonych

Mam kod

% define the dimention of 2d space (50 bricks in one row)
M=50;
N=50;
%a=1, b=1, c=1, d=1, -4 this can be changed for another than poisson
%equaitons
a=ones(M, N); %this gives the matrix (M,N) of ones
b=ones(M, N); 
c=ones(M, N); 
d=ones(M, N); 
e=ones(M, N)*-4;
%initialise the source term to 0 values
f = zeros(M,N);
%once r is calculated, r is solution of the system and hold r
%otherwise assume solution to be 0
if ~exist('r')
    u = zeros(M,N);
else
    u = r;
end

tic %record the current time, use later to calculate how much time matlab spends on something

%f = -double(randn(M,N)>0.999999); 
xd = linspace(0,1,M); %values from 0 to 1, there are 50 values
yd = linspace(0,1,N);

%define space 
[X,Y] = meshgrid(xd, yd);

f = -( 6*X.*Y*(1-Y)-2*X.^3 ); %source term
%f = zeros(M,N);
%define the boudnary conditions
u(:,1)=0; %u(y=1) = 0
u(:,N)=0; % u(y= ymax) = 0
u(1,:)=1;  %u( x=1) =1

y = linspace(0,1,N);
u(M,:)=1+y.*(1-y); 
%end of defining boundary conditions

r = sor(a,b,c,d,e,f,u,0.99999,50000);%equation parameters, source term, u (solution domain) , dimention of 2D space, delta value parameter, interation

toc %record the current time

imagesc(r)
figure 
imagesc(f)

co tu jest nie tak? nie mogę w ogóle go uruchomic?>

0

używasz niezdefiniowanej funkcji sor

1 użytkowników online, w tym zalogowanych: 0, gości: 1