Adding an extra point in a grid in finite element code
조회 수: 1(최근 30일)
표시 이전 댓글
Dears,
I am using this code that solves the 1D BVP -au'' + bu' + cu = f in (x0, x1) at x0 to x1.
I am diving the intervals to n=16.
I need to add an extra node (point) between the last two nodes so it will be between 15/16 and 16/16.
Any Idea how to do so?
Here is the part of the code concerning the intervals and the matrix forming:
n = 16;
x = linspace(leftbdr.x, rightbdr.x, n+1);
% assemble matrix A
A = sparse(n+1,n+1);
for i=1:n % on each sub-interval [x(i), x(i+1)]
localmat = assembleLocalMatrix(x(i),x(i+1),coefficients);
A(i:i+1,i:i+1) = A(i:i+1,i:i+1) + localmat;
end
% assemble right-hand side vector rhs = (f,v)
rhs = zeros(n+1,1);
for i=1:n % on each sub-interval [x(i), x(i+1)]
localrhs = assembleLocalRhs(x(i),x(i+1),f);
rhs(i:i+1) = rhs(i:i+1) + localrhs;
end
Thanks
댓글 수: 0
답변(0개)
참고 항목
범주
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!