Plot and interp using Spline method
    5 views (last 30 days)
  
       Show older comments
    
I'm trying to correct this line ploting using interpolate method .
but seem blocky shape appears
the coding in the body 
function [TI1,TI2,TI3] = ER_Function 
er1=(1+1.8*10^14*1i); 
er2=(2.5+2.5*10^-3*1i);
Hc=(10^6);
H1=(0); 
P1= 0:0.02:0.30;
Pc=(0.33).*exp((-(H1)/Hc));
c1=(1-3*Pc).*(((P1)./(Pc)).^Pc).*(((1-P1)./(1-Pc)).^(1-Pc)); 
T1=(1./(2.*(2+c1))).*(((3*P1-1+c1)*er1+(2-3.*P1-c1)*er2)+(((((3*P1-1+c1)*er1+(2-3.*P1)*er2).^2)+(4.*(er1).*(er2).*(1-c1).*(2+c1))).^0.5)); 
PI1=[0,0.20,0.23,0.25,0.27,0.30];
TI1= spline (P1,T1,PI1);
P2= 0:0.02:0.30; 
er1=(1+1.8*10^14*1i);
er2=(2.5+2.5*10^-3*1i); 
Hc=(10^6);
H2=(10^6);
Pc=(0.33).*exp((-(H2)/Hc));
c2=(1-3*Pc).*(((P2)./(Pc)).^Pc).*(((1-P2)./(1-Pc)).^(1-Pc)); 
T2=(1./(2.*(2+c2))).*(((3*P2-1+c2)*er1+(2-3.*P2-c2)*er2)+(((((3*P2-1+c2)*er1+(2-3.*P2)*er2).^2)+(4.*(er1).*(er2).*(1-c2).*(2+c2))).^0.5)); 
PI2=[0,0.20,0.23,0.25,0.27,0.30];
TI2= spline (P2,T2,PI2);
P3= 0:0.02:0.30;
er1=(1+1.8*10^14*1i); 
er2=(2.5+2.5*10^-3*1i);
Hc=(10^6);
H3=(2*10^6);
Pc=(0.33)*(exp(-H3/Hc));
c3=(1-3*Pc).*(((P3)./(Pc)).^Pc).*(((1-P3)./(1-Pc)).^(1-Pc)); 
T3=(1./(2.*(2+c3))).*(((3*P3-1+c3)*er1+(2-3.*P3-c3)*er2)+(((((3*P3-1+c3)*er1+(2-3.*P3)*er2).^2)+(4.*(er1).*(er2).*(1-c3).*(2+c3))).^0.5)); 
PI3=[0,0.20,0.23,0.25,0.27,0.30];
TI3= spline (P3,T3,PI3);
J=plot ( PI1, real(TI1),'r',PI2, real (TI2),'g',PI3, real (TI3) , 'b');
J(1).LineWidth = 2;
J(2).LineWidth = 2;
J(3).LineWidth = 2;
title('Magnetic Field' ),xlabel('(P) concentration Volume'),ylabel('\bf\epsilon^e','FontSize',20)
legend({'H1=0','H2=10^6','H3= 2*10^6'},'Location','northwest','NumColumns',3)
end
2 Comments
Answers (1)
  the cyclist
      
      
 on 17 Jun 2019
        It's presumably because you have not chosen your query points to be very close together. Do you get something closer to what you expect if you define something like
PI3=[0:0.002:0.30];
0 Comments
See Also
Categories
				Find more on Splines in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

