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

8 visualizaciones (últimos 30 días)
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 comentarios

Iniciar sesión para comentar.

Respuesta aceptada

Alan Stevens
Alan Stevens el 8 de Sept. de 2020
Editada: Alan Stevens el 8 de Sept. de 2020
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.

Más respuestas (0)

Etiquetas

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by