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

8 ビュー (過去 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 件のコメント
Anup Negi
Anup Negi 2020 年 9 月 8 日
Can you send your eamil I'd sr

サインインしてコメントする。

採用された回答

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 件)

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by