how to developed numerical code for collocation method for linear differential equations

조회 수: 27 (최근 30일)
please sr/ ma'am
our big problem to creat code in MATLAB
i can't undestand , how to write down the diifential equation and boundary condition in matlab
  댓글 수: 3

댓글을 달려면 로그인하십시오.

채택된 답변

Alan Stevens
Alan Stevens 2020년 9월 8일
편집: Alan Stevens 2020년 9월 8일
I've just noticed you want to use a collocation method. So you proceed as follows
% For method of collocation choose a functional form for U
% Suppose, for simplicity you choose a simple parabola
% u(z) = a + b*z + c*z^2 (u is potential approximate version of U)
% dudz(z) = b + 2c*z
% d2ud2 = 2*c
% where a, b and c are constants to be determined.
%
% The actual ODE is
% d2Udz2 + A*dUdz + B = 0 where (presumably) you know A and B.
%
% so with your approximate solution this would become
% 2c + A*(b + 2c*z)+ B = 0
% choose a collocation point, z = zcol, say and this becomes
% 2c + A*(b + 2c*zcol)+ B = 0 ...(1)
%
% Assuming you know U on your boundaries, z = eta and z = 1 you also have
% U(eta) = a + b*eta + c*eta^2 ...(2)
% U(1) = a + b + c ...(3)
%
% You now have three equations with which to find a, b and c
% This can be done easily with
% M = [0 A 2+2*A*zcol; 1 eta eta^2; 1 1 1];
% V = [-B; U(eta); U(1)];
% [a; b; c] = M\V;
%
% so your approximate solution is: u(z) = a + b*z + c*z^2
%
% If you want to use more collocattion points you'll need to
% choose a higher order approximate equation.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

제품


릴리스

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by