【问题标题】:How to plot Multiple Hysteresis loops on polar grid in Python/Matlab?如何在 Python/Matlab 中在极坐标网格上绘制多个滞后环?
【发布时间】:2016-02-29 20:13:46
【问题描述】:

我想在 Python 或 Matlab 中在极坐标网格上绘制多个磁滞回线(如下图所示,取自一篇论文)。我知道如何在 matlab 中使用极坐标图函数,但我正在努力解决如何解决这个问题,特别是重新调整磁滞回线以及如何定义 theta 和 rho 以便每个回路以特定角度出现。

【问题讨论】:

  • 似乎有带有极坐标网格和“八点”的主轴和带有磁滞回线的 18 个短轴。
  • 这是出自哪篇论文?

标签: python matlab matplotlib polar-coordinates


【解决方案1】:

如果您不依赖一个轴上的图形。 假设我们有两个矩阵 HystXHystY 包含 N 行,每个行都描述了 i-th 滞后循环。

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 plot 在“真实的隐藏轴”中创建了“假轴”(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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-12
    • 1970-01-01
    • 1970-01-01
    • 2021-10-21
    • 1970-01-01
    相关资源
    最近更新 更多