2016-02-29 76 views
0

我想在Python或Matlab中绘制极坐标网格上的多个滞后环(如下图所示 - 从纸张中获取)。我知道如何在matlab中使用极坐标函数,但是我正在努力解决这个问题,特别是重新缩放滞后环以及如何定义rho,使每个循环出现在特定的角度。如何在Python/Matlab中绘制极坐标网格上的多个迟滞循环?

enter image description here

+0

它看起来像有主轴与极坐标网格和“八点八”和18个具有滞后环的副轴。 – Crowley

回答

1

如果你没有在一个轴上依靠图形。 假设我们有两个矩阵HystXHystY包含N行,每行描述了i-滞后循环。

polar(0,1.5) % Hack to get 8 smaller 
hold on 
polar(1:0.1:2*pi(),abs(sin(1:0.1:2*pi()))) % Print the eight 
set(gcf,'units','centimeters') 
set(gca,'units','centimeters') 

AXpos=get(gca,'position') % axes position 
AXCentre=[AXpos(1)+0.5*AXpos(3);AXpos(2)+0.5*AXpos(4)]; 
Radius=min(AXpos(3:4)); 

N=18; % Number of hysteresis loops 

Theta=0:1/N:1-1/N; % distribute Theta evenly 
Theta=2*pi()*Theta; % distribute Theta in range of (0,2Pi) 

% coordinates of centres of minor axes relative to major axes centre. 
axX=2/3*Radius*cos(Theta); 
axY=2/3*Radius*sin(Theta); 

% align the reference centre with centre of major axes, compensate dimensions of minor axes 
axX=axX+AXCentre(1)-0.5; % -0.5 for axes with width/height = 1 
axY=axY+AXCentre(2)-0.5; 

for ii=1:N 
    MinorAX=axes('units','centimeters','position',[axX(ii),axY(ii),1,1]) 
    line=('xdata',HystX(ii,:),'ydata',HystY(ii,:),'parent',MinorAX(ii)) 
end 

set(MinorAX,'visible','off') %disappear minor axes; 

如果你想在一个坐标轴你可以用这个例子拥有一切: 在我生成设置“磁滞回线”的第一部分,然后我绘制在极坐标系“8”,最后我积滞后循环。 这是基于这样一个事实,即polar图在“真实,隐藏的轴”内创建“假轴”(set(gca,'visible','on')将显示它们)。

close all;clear all;  % get rid off variables and figures 
N=12;      % number of hysteresis loops 
HystX=zeros(N,100);   % X-values for loops 
HystY=HystX;    % Y-values for loops 
TempH=2*pi()*[0:0.01:1]; % Base for loops' content 
TempV=2*pi()*[0:1/N:1-1/N]; % Phase lead to differ the loops; position of the loop in axes 
%% Calclate the loops' cooordinates 
for ii=1:N 
    for jj=1:101 
    HystX(ii,jj)=0.1*cos(TempH(jj)); 
    HystY(ii,jj)=0.1*sin(TempH(jj)+TempV(ii)); 
    end 
end 

%% Plot the content oi polar axes 
polar(0,2) 
hold on 
polar(TempH,abs(sin(TempH))) 
% set(gca,'visible','on') 

%% Plot the hysteresis loops. 
for ii=1:12 
    line('xdata',HystX(ii,:)+(1.5*cos(TempV(ii))),... 
     'ydata',HystY(ii,:)+(1.5*sin(TempV(ii)))) 
end