[英]How can I plot the derived function of cubic spline interpolation?
我想問一下如何繪制三次樣條插值的導出函數? 我在我的代碼中展示了我是如何做到的。 錯誤是:
Error using plot Invalid second data argument Error in function_MTU4000_Real (line 90) plot1=plot(x1,Speed1,'b');
%calculation of lifting of intake valve (approximation spline function)
x1=0.0:0.1:202.1;
y1=xlsread('Steuerzeiten_Schrittweite_MTU4000.xlsx',1,'D2:D2023');
Lifting1=spline(x1,y1);
x2=202.1:0.1:701.9;
Lifting2=0*x2;
x3=702.0:0.1:720.0;
y3=xlsread('Steuerzeiten_Schrittweite_MTU4000.xlsx',1,'D7022:D7202');
Lifting3=spline(x3,y3);
%calculation and plot of speed intake
figure(2);hold on; grid on;
Speed1=fnder(Lifting1);
plot1=plot(x1,Speed1,'b');
Speed2=Lifting2;
plot2=plot(x2,Speed2,'b');
Speed3=fnder(Lifting3);
plot3=plot(x3,Speed3,'b');
hold off
legend([plot1,plot2,plot3],'Intake')
set(gca,'XTickLabel',{'OT','90','UT','270','ZOT','450','UT','630','OT'});
title('Intake Valve Speed')
xlabel('Crank Angle [°]')
ylabel('Speed [m/°]')
fnder
返回一個結構體,而不是一個用於繪圖的數組。 您必須使用ppval
或fnval
來評估它...
plot1 = plot(x1, ppval(Speed1,x1))
文檔:
有關使用csapi
請參閱文檔: https : csapi
% docs example
bcs = csapi( {x,y}, z );
fnplt( bcs )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.