How do you apply a rotating (in time) 2d gaussian function to a round plate with a center hole, my script does not seem to rotate the function?

4 次查看(过去 30 天)
clear all
close all
model=createpde('thermal','transient')
geo=multicylinder([1/2,4/2],0.04,"Void",[1,0])
model.Geometry = geo;
pdegplot(model,'FaceLabels','on','CellLabels','on');grid on
generateMesh(model,'Hmax',0.2)
pdeplot3D(model)
thermalProperties(model,'ThermalConductivity',2.1,...
'MassDensity',1050,...
'SpecificHeat',822)
a = linspace(-2,2,100);
b = linspace(-2,2,100);
time = linspace(0,20,21);
[x,y] = meshgrid(a,b)
state.time = meshgrid(time)
location.x = x;
location.y = y;
thermalIC(model,22)
thermalBC(model,'Face',1,'Temperature',22)
thermalBC(model,'Face',2,'HeatFlux',@externalHeatFlux)
pdeplot3D(model)
t=0:1:20
state.time = t;
modelresults = solve(model,t)
figure
for n=1:numel(modelresults.SolutionTimes)
pdeplot3D(model.mesh,"ColorMapData",modelresults.Temperature(:,n))
drawnow
pause(0.2)
end
function flux=externalHeatFlux(location,state)
t = state.time
A = 1;
x0 = 0;
y0 = 0;
sx = 0.5;
sy = 2;
for index=1:length(t)
ang = 2*(index-1);
flux(:,:,index) = imrotate(A*exp(-(((location.x-x0).^2/(2*sx^2)) +...
((location.y-y0).^2/(2*sy^2)))).*exp(-t(index)),ang,'crop')
end
end

回答(1 个)

Ziggy Hoffnung
Ziggy Hoffnung 2024-6-10
Torsten's answer resolved the question:
Did you check state.time, location.x and location.y in your function ? My guess is that they are simply scalar values so that application of "imrotate" doesn't make sense

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by