matlab中如何将极坐标函数转化为直角坐标函数并绘图
alpha=pi/6;sigmaH=48.6%最大水平地应力;sigmav=53.68%垂向地应力;K=93500%切变模量;v=0.218%泊松比;k=2.128;fo...
alpha=pi/6;
sigmaH=48.6%最大水平地应力;
sigmav=53.68%垂向地应力;
K=93500%切变模量;
v=0.218%泊松比;
k=2.128;
for i=1:100
r=i;
for j=1:100
n=pi/50;
theta=n*j;
sigma=(sigmaH+sigmav)/2+(sigmaH-sigmav)*cos(2*alpha)/2;
tau=(sigmaH-sigmav)*sin(2*alpha)/2;
K1=sigma*(2*pi)^0.5;
K2=tau*(2*pi)^0.5;
sigmax(i,j)=K1*(3*cos(0.5*theta)+cos(2.5*theta))/(4*(2*pi*r)^0.5)- K2*(7*sin(0.5*theta)+sin(2.5*theta))/(4*(2*pi*r)^0.5);
sigmay(i,j)=K1*(5*cos(0.5*theta)-cos(2.5*theta))/(4*(2*pi*r)^0.5)- K2*(sin(0.5*theta)-sin(2.5*theta))/(4*(2*pi*r)^0.5);
tauxy(i,j)=-K1*(sin(0.5*theta)-cos(2.5*theta))/(4*(2*pi*r)^0.5)- K2*(3*cos(0.5*theta)+cos (2.5*theta))/(4*(2*pi*r)^0.5);
u(i,j)=(K1/(4*K))*(r/(2*pi))^0.5*((2*k-1)*cos(0.5*theta)-cos(1.5*theta))+ (K2/(4*K))*(r/(2*pi))^0.5*((2*k+3)*sin(0.5*theta)+sin(1.5*theta));
v(i,j)=(K1/(4*K))*(r/(2*pi))^0.5*((2*k+1)*sin(0.5*theta)-sin(1.5*theta))- (K2/(4*K))*(r/(2*pi))^0.5*((2*k-3)*cos(0.5*theta)+cos(1.5*theta));
end
end
这里要求的几个函数都是极坐标下的,自变量为theta和r,我想取theta范围为pi/50到2*pi,取r范围为1到100。但是matlab默认是直角坐标系,也就把这个图像全部绘制在直角坐标系的第一象限了。我想问下,如何把这个极坐标系下的函数转化为直角坐标系下,然后绘制出sigmax,sigmay,tauxy,u,v,这几个函数大的三维图像。万分感谢! 展开
sigmaH=48.6%最大水平地应力;
sigmav=53.68%垂向地应力;
K=93500%切变模量;
v=0.218%泊松比;
k=2.128;
for i=1:100
r=i;
for j=1:100
n=pi/50;
theta=n*j;
sigma=(sigmaH+sigmav)/2+(sigmaH-sigmav)*cos(2*alpha)/2;
tau=(sigmaH-sigmav)*sin(2*alpha)/2;
K1=sigma*(2*pi)^0.5;
K2=tau*(2*pi)^0.5;
sigmax(i,j)=K1*(3*cos(0.5*theta)+cos(2.5*theta))/(4*(2*pi*r)^0.5)- K2*(7*sin(0.5*theta)+sin(2.5*theta))/(4*(2*pi*r)^0.5);
sigmay(i,j)=K1*(5*cos(0.5*theta)-cos(2.5*theta))/(4*(2*pi*r)^0.5)- K2*(sin(0.5*theta)-sin(2.5*theta))/(4*(2*pi*r)^0.5);
tauxy(i,j)=-K1*(sin(0.5*theta)-cos(2.5*theta))/(4*(2*pi*r)^0.5)- K2*(3*cos(0.5*theta)+cos (2.5*theta))/(4*(2*pi*r)^0.5);
u(i,j)=(K1/(4*K))*(r/(2*pi))^0.5*((2*k-1)*cos(0.5*theta)-cos(1.5*theta))+ (K2/(4*K))*(r/(2*pi))^0.5*((2*k+3)*sin(0.5*theta)+sin(1.5*theta));
v(i,j)=(K1/(4*K))*(r/(2*pi))^0.5*((2*k+1)*sin(0.5*theta)-sin(1.5*theta))- (K2/(4*K))*(r/(2*pi))^0.5*((2*k-3)*cos(0.5*theta)+cos(1.5*theta));
end
end
这里要求的几个函数都是极坐标下的,自变量为theta和r,我想取theta范围为pi/50到2*pi,取r范围为1到100。但是matlab默认是直角坐标系,也就把这个图像全部绘制在直角坐标系的第一象限了。我想问下,如何把这个极坐标系下的函数转化为直角坐标系下,然后绘制出sigmax,sigmay,tauxy,u,v,这几个函数大的三维图像。万分感谢! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询