- use meshgrid to create X, Y and Z matrices
- use surf with cdata property to assign colors
pcolor function axes switch
조회 수: 19 (최근 30일)
이전 댓글 표시
clc
clear
epsilon0=8.9*10^(-12);
epsilon1=1;
epsilon2=9;
eta0 = 377;
eta1 = eta0/(sqrt(epsilon1));
eta2 = eta0/(sqrt(epsilon2));
ro=(eta2-eta1)/(eta2+eta1);
tau=1+ro;
mu = 1.2566*10^(-6);
w = 2*pi*300*10^6;
beta1 = w*sqrt(mu*epsilon0*epsilon1); %fase
beta2 = w*sqrt(mu*epsilon0*epsilon2);
tetai=30;
tetar=tetai;
tetat= asin(sqrt(epsilon1)*sin(tetai)/sqrt(epsilon2));%Snell;
PERIODO=1/(300*10^6);
dt = PERIODO / ( 100 );
tempo = [ 0 : dt : PERIODO * 3];
pluto=linspace(0,3,100);
[x,z]=meshgrid(pluto,pluto); %invertito x e z
%Intensità campo elettrico
Ey=3;
hold on
axis ([0,200,0,200]) % i 4 valori sono xmin, xmax, ymin, ymax
for i = 1:numel(tempo) %numel="number of elements"
t = tempo(i);
Eiy=Ey*[cos(w*t-beta1*(-x*sin(tetai)+z*cos(tetai)))];
Hix=-(Ey/eta1)*(cos(tetai))*[cos(w*t-beta1*(-x*sin(tetai)+z*cos(tetai)))];
Ery=ro*Ey*[cos(w*t-beta1*(x*sin(tetar)-z*cos(tetar)))];
Hrx=ro*(Ey/eta1)*cos(tetar)*[cos(w*t+beta1*(-x*sin(tetar)-z*cos(tetar)))];
Ety=tau*Ey*[cos(w*t-beta2*(x*sin(tetat)+z*cos(tetat)))];
Htx=-tau*(Ey/eta2)*cos(tetat)*[cos(w*t-beta2*(x*sin(tetat)+z*cos(tetat)))];
concat_img=[Eiy+Hix Ety+Htx; Ery+Hix Ety+Htx];
xlabel('asse x')
ylabel('asse y')
zlabel('asse z')
%concat_img2=[Ety+Htx;Ery+Hrx];
pcolor(concat_img);
shading interp;
%pcolor(concat_img2);
drawnow
M(i)=getframe;
%drawnow
%pcolor(Eiy+Hix);
%pcolor(Ery+Hrx);
%M(i)=getframe;
end
I need to plot with pcolor an oblique incidence in the x-z plane. The problem is that the pcolor function creates the plot in the x-y plane.
How can i switch the axes?
댓글 수: 0
답변 (2개)
Walter Roberson
2020년 5월 20일
Create a hgtransform group. When you pcolor(), set its Parent to be the hgtransform group. Use makehgtform to build a transform matrix that rotates the axes as required. Set that as the Matrix of the hgtransform group.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Axes Appearance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!