필터 지우기
필터 지우기

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?

조회 수: 5 (최근 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
  댓글 수: 2
Torsten
Torsten 2024년 5월 20일
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.

댓글을 달려면 로그인하십시오.

답변 (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