February 28th, 2014, 02:43 AM  #1 
Newbie Joined: Feb 2014 Posts: 1 Thanks: 0  Matlab AND PDE (Program)
Can someone correct my matlab program? Thank you. my equation is: dU/dtvd2U/dx2=f(x) U(0)=U(1)=1 U(0,x)=U0(x) My program: %% Equation of heat in a uniform discretization with interval %% geometry dx = 0.01; % Calculation interval x_max = 1; x_min = 0; % Position vector, vector for Dirichlet and number of points X = x_min:dx_max; X_Dirichlet = X(2:length(X)1)'; NX = length(X_Dirichlet); %% data problem U0 = zeros(NX,1); dt = 0.01; % final time T = 1; % Function f d = 0.1; f = @(x) exp(x.^2/d); % right member F = f(X_Dirichlet); % Coefficient mu mu = 1; %% Laplacian matrix % diagonal D1 = (dx)^(2)*ones(NX,1); D2 = 2*(dx)^(2)*ones(NX,1); D3 = (dx)^(2)*ones(NX,1); %Array creation A = spdiags([D1 D2 D3], 1:1, NX, NX); %% Resolution of the system % initialization U = U0; for k = 1 : ceil(T/dt) U = (1/dt  A)(U/dt + F); figure(1) plot(X_Dirichlet,U); end 

Tags 
matlab, pde, program 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Modification of Matlab program  uplifting  Math Software  0  December 15th, 2013 10:35 AM 
Matlab program Integral equations Nystrom method  philosofer  Applied Math  0  June 9th, 2013 01:10 AM 
What do you guys think of this program..?  rage  Academic Guidance  2  July 5th, 2012 08:51 AM 
Fractal Program  boy129349  Computer Science  3  February 6th, 2012 07:13 AM 
Geometry Program  davidandersson  Geometry  2  August 23rd, 2010 08:28 AM 