Elliptic PDE-Laplace Equation. Heated in the center of the square plate

Поділитися
Вставка
  • Опубліковано 14 жов 2024
  • #Laplace #elliptic #PDE #Matlab #finitedifferences
    Elliptic PDE-Laplace Equation. Heated in the center of the square plate.
    clc;clear;close all;
    x0=0; xf=1;
    y0=0; yf=1;
    nx=121; ny=121;
    x=linspace(x0,xf,nx);
    y=linspace(y0,yf,ny);
    dx=x(2)-x(1);
    dy=y(2)-y(1);
    T=zeros(nx,ny); %preallocation matrix
    % Calculate the center coordinates of the matrix
    %www.mathworks....
    [rows, cols] = size(T);
    center_row = ceil(rows/2);
    center_col = ceil(cols/2);
    % Define the size of the mini square
    square_size = 4;
    % Calculate the starting row and column indices of the mini square
    start_row = center_row - floor(square_size/2);
    start_col = center_col - floor(square_size/2);
    % Extract the mini square
    T_center = T(start_row:start_row+square_size-1, start_col:start_col+square_size-1);

КОМЕНТАРІ •