フィルターのクリア

How to plot interpolated temperature of a sphere in 2-D?

6 ビュー (過去 30 日間)
CHARILAOS
CHARILAOS 2023 年 4 月 15 日
回答済み: Amal Raj 2023 年 4 月 18 日
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

回答 (1 件)

Amal Raj
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.

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by