MATLAB: How to apply a sinusoidal heat input into one of the faces of a 3-D PDE model? And how would I show the results at several different timestamps at once

3d3d plots

This is what I currently have at the moment:
model = createpde; g = importGeometry(model, 'Unit cell for MATLAB 2.stl'); pdegplot(g,'FaceLabels','on', 'FaceAlpha',0.5)
applyBoundaryCondition(model,'neumann','Face',2,'g', sin(2*tlist));
applyBoundaryCondition(model,'neumann','Face',1,'g',0);
applyBoundaryCondition(model,'neumann','Face',3,'g',0);
applyBoundaryCondition(model,'neumann','Face',5:6,'g',0);
applyBoundaryCondition(model,'dirichlet','Face',4,'u',0);
specifyCoefficients(model,'m',0,'d',1,'c',1,'a',0,'f',0);
setInitialConditions(model,300);
generateMesh(model,'Hmax',0.3);
tlist = 0:1:10;
results = solvepde(model,tlist);
u = results.NodalSolution;
pdeplot3D(model,'ColorMapData',u(:,2))
The codeline in bold corresponds to the selected face and boundary type that corresponds to it. From what I understood in my reading, the g coeff is where I need to add the sinusoidal wave function. I've tried moving up the tlist variable to the line just before the bolded code but to no avail.

Best Answer

You need to pass a nonconstant boundary condition coefficient as a function handle with the correct syntax. For your case, I would imagine that the function is @(region,state)sin(2*state.time).
Alan Weiss
MATLAB mathematical toolbox documentation