www.pudn.com > ja20131006.rar > hystersis_ja.asv, change:2013-05-07,size:1961b


% HYBRID JA FERROMAGNETIC HYSTERESIS SIMULATOR 
%b:Models temperature effects in the Anhystretic 
%Curve,M=Ms*b*H/(1+b*norm(H)). 
%Ms: Saturation Magnetization. 
%c:JA linearity factor. 
%Hs:User defined magnetic field vector. It must be a Ní┴3 vector with duration N*dt. 
%The default pararameter values are:b=1 Ms=1 e=[0,0,0]n Ku=0 K0=0 K1=0 a=0 c=1 f=1 dt=1/(1000*f) NTo=5Ho=10*Ku/Ms or Ho=10/b(if Ku=0) 
clear 
f=40; 
dt=1/(f*1000); 
NTo=5; 
Hmax=10000; 
a=1000; 
alpha=0.001; 
beta=5000; 
c=0.1; 
b=1000; 
Ms=1.7E+6; 
k=2000; 
 
  len=round(NTo/(f*dt)); 
    T=linspace(0,NTo/f,len); 
    hs=(sin(2*pi*f*T))'; 
     
 
disp('******************'); 
disp('Setting up Simulation'); 
disp('******************'); 
varargin 
s=size(hs); 
len=s(1); 
col=s(2); 
disp('************'); 
disp('Simulation set up & runing......'); 
disp('************'); 
disp(''); 
 
%Main JA Algorithm 
mirr=0; 
m=0; 
OUT1=zeros(len,col);OUT2=zeros(len,col); 
OUT3=zeros(len,col) 
lasthe=0; 
lastm=0; 
for i=1:len 
    dm=1;n=0; 
      h=hs(i+1);      
       
      dhs=hs(i+1)-hs(i); 
      if(dhs>0) 
          delta=1; 
      else 
          delta=-1; 
      end 
    while(n<100)&&(norm(dm)>1E-10) 
        if( n == 450) 
            str=sprintf('      i=\t\t%1.3f           n=\t\t%1.3f',i,n) 
        end 
        H=h*Hmax; 
        M=m*Ms; 
        He=H+alpha*M;       
        he=He/Hmax; 
        dhe=he-lasthe;     
        man=(coth((He)/a)-a/(He)); 
       % man=beta*He/(1+beta*He); 
        %classical JA Implementation 
                 dmirr=(Hmax/k)*(man-mirr)*delta*dhe; 
                 mirr=mirr+dmirr;     
         m=c*man+(1-c)*mirr; 
         dm=lastm-m; 
          lasthe=he; 
          lastm=m; 
          n=n+1; 
    end 
    OUT1(i,:)=M; OUT2(i,:)=man*Ms; OUT3(i,:)=he*Hmax; 
end 
figure 
plot(hs*Hmax,OUT1,'k','LineWidth',2.5) 
hold; 
xlabel('Hx') 
ylabel('Mx') 
figure 
plot(hs*Hmax,OUT2,'k','LineWidth',2.5) 
hold; 
xlabel('Hx') 
ylabel('Man')