Filter löschen
Filter löschen

Applying Neumann boundary conditions to a system

17 Ansichten (letzte 30 Tage)
John Bach
John Bach am 2 Mär. 2023
Beantwortet: Abhijeet am 6 Mär. 2023
Hi there,
My system comprises a 2D rectangular plate of legnth 1 unit and width 2 units. I am currently trying to apply Neumann boundary conditions to this system.
So far, I have formed a discrete Laplaican using the delsq function and now want to impose Neumann boundary conditions at all sides of the plane although I am struggling to work out how I can do this.
Any suggestions as to how I could go about doing this would be greatly appreciated.
Best regards,

Akzeptierte Antwort

Abhijeet
Abhijeet am 6 Mär. 2023
Hi,
To impose Neumann boundary conditions, modify the Laplacian matrix to account for the boundary conditions. The Laplacian matrix is formed using the delsq function, which discretizes the Laplacian operator.
To impose Neumann boundary conditions, modify the Laplacian matrix by adjusting the rows and columns corresponding to the boundary nodes. Here is some sample code that demonstrates how to modify the Laplacian matrix to impose Neumann boundary conditions on a rectangular plate with a length of 1 unit and a width of 2 units:
% Let nx be the number of grid points in x direction
% Lap be the Laplacian Matrix formed by the delsq function
% Modify the Laplacian matrix to impose Neumann boundary conditions on all sides of the plate
for i = 1:nx
% Modify the top and bottom rows
Lap(i,:) = Lap(i,:) - Lap(i,1);
Lap(i,:) = Lap(i,:) - Lap(i,end);
% Modify the left and right columns
Lap(:,i) = Lap(:,i) - Lap(1,i);
Lap(:,i) = Lap(:,i) - Lap(end,i);
end
Thanks

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by