how to solve PDE with derivative boundary conditions ?
Afficher commentaires plus anciens
hey all
im trying to solve PDE with derivative boundary condition , so i tend to use the imaginary node method , could i have another way to solve it without any built in function
this is the qustion:
𝜕𝑇𝜕𝑡=𝜕2𝑇𝜕𝑥2+𝑞(𝑥) (1)
With 𝑞(𝑥)=100sin(𝜋𝑥) (2)
1)
𝑇(𝑥,0)=0 (3)
2)
𝜕𝑇𝜕𝑡(0,𝑡)=𝑇(0,𝑡)−10 (4)
3)
𝜕𝑇𝜕𝑡(1,𝑡)=10−𝑇(1,𝑡) (5)
clear all;
close all;
clc;
%% Demo program for parapolic pde
dt = 0.25;
dx = 0.1*dt;
alpha=1;
t = 0:dt:15;
x = 0:dx:4;
q_x=(100*sin(pi*x));
N = length(x)-1;
T=[]; %Dynamic size
T(1,:) = zeros(1,5) ; %Initial condition
for j=1:length(t)-1
T(1,N-1) = T(j+1,N) + (2*dx*(T(j+1,N+1)-10));
for i=2:N
T(j+1,i) = T(j,i)+alpha*(dt/(dx^2))*(T(j,i+1)+ T(j,i-1)-2*T(j,i))+q_x;
end
T(2,N+2) = T(j+1,N) + (2*dx*(10-T(j+1,N+1)));
end
mesh(t,x,T)
colorbar;
the code isn't evaluated , what is the proplem?
3 commentaires
Mohammad Adeeb
le 2 Avr 2021
Mohammad Adeeb
le 2 Avr 2021
Mohammad Adeeb
le 2 Avr 2021
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur PDE Solvers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
