How can I get a smooth curve in MATLAB?
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Itqan Ismail
 am 31 Jan. 2023
  
    
    
    
    
    Kommentiert: Star Strider
      
      
 am 31 Jan. 2023
            x=[0:30:210];
%Composition
%Outlet Specification [PFAD(4)]
y=[44.0789 62.428 77.24324 85.35 89.435 91.353 92.504 92.6252];%FFA
z=[90.4422 59.243 32.241 13.8 5.232 1.2421 0.6243 0.5465];%TAG
plot(x,y,'-b',x,z,'--r')
title('composition vs time');
xlabel('time'); 
ylabel('xd'); 
legend('a) FFA','b)TAG');

0 Kommentare
Akzeptierte Antwort
  Star Strider
      
      
 am 31 Jan. 2023
        One option is to interpolate to a finer ‘x’ vecttor, and then use a method such as 'pchip', 'spline', 'makima', or others to do a smoother interpolation.  
Example —      
x=[0:30:210];
%Composition
%Outlet Specification [PFAD(4)]
y=[44.0789 62.428 77.24324 85.35 89.435 91.353 92.504 92.6252];%FFA
z=[90.4422 59.243 32.241 13.8 5.232 1.2421 0.6243 0.5465];%TAG
figure
plot(x,y,'-b',x,z,'--r')
title('composition vs time');
xlabel('time'); 
ylabel('xd'); 
legend('a) FFA','b)TAG');
xv = linspace(min(x), max(x), numel(x)*10);
yv = interp1(x, y, xv,'pchip');
zv = interp1(x, z, xv,'pchip')
figure
plot(xv,yv,'-b',xv,zv,'--r')
title('composition vs time');
xlabel('time'); 
ylabel('xd'); 
legend('a) FFA','b)TAG');
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



