How to plot interpolated temperature of a sphere in 2-D?
8 次查看(过去 30 天)
显示 更早的评论
I am writing a script for solving the heat equation on the surface of a hollow sphere. To make my life easier i use spherical coordinates through sph2cart function.I am also using the pde toolbox. After i solve the equation with my specified boundary and initial conditions i want to interpolate the temperature on a specific slice of the surface of a sphere.Lets say the curve on the sphere has Rho=5(radius),Theta(altitude),Phi=0(my model is symmetric on the azimuth angle). The problem occurs with plotting the interpolated temperature. More specifically what i want to plot is the temperature in respect to the altitude.How can i achieve that? Any help is greatly appreciated
The code i use for this is as follows:
tlist = 0:10:100; %time frame
thermalresults = solve(model,tlist);
T = thermalresults.Temperature;
[phiG,thetaG,rG] = meshgrid(0,linspace(-pi/2,pi/2),5);
[xG,yG,zG] = sph2cart(phiG,thetaG,rG);
region.xG = xG;
region.yG = yG;
region.zG = zG;
Tintrp = interpolateTemperature(thermalresults,xG,yG,zG,1:length(tlist));
t = [1:25:100];
figure
for i = t
p(i) = plot(xG,Tintrp(:,i),"DisplayName", ...
strcat("t=",num2str(tlist(i))));
hold on
end
0 个评论
回答(1 个)
Amal Raj
2023-4-18
Hi Charilaos,
To plot the temperature as a function of altitude, you can interpolate the temperature values onto the slice of the sphere that you are interested in, and then plot the interpolated values against the altitude coordinate.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!