我想问一下如何绘制三次样条插值的导函数?我在代码中展示了我是如何做到这一点的。错误是:
在function_MTU4000_Real (第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/°]')发布于 2017-01-31 17:02:07
fnder返回一个结构,而不是一个用于绘图的数组。您必须使用ppval或fnval来评估它...
plot1 = plot(x1, ppval(Speed1,x1))文档:
有关使用csapi的信息,请参阅文档:https://uk.mathworks.com/help/curvefit/csapi.html
% docs example
bcs = csapi( {x,y}, z );
fnplt( bcs )https://stackoverflow.com/questions/41948311
复制相似问题