2017-01-31 4 views
1

입방 스플라인 보간의 파생 함수를 어떻게 나타낼 수 있습니까? 내 코드에서 어떻게했는지 보여줍니다. 오류 :3 차 스플라인 보간의 파생 함수를 어떻게 그릴 수 있습니까?

function_MTU4000_Real에 플롯 잘못된 2 데이터를 인수 (라인 90) plot1 플롯 = (X1, 연사 1, '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/°]') 

답변

0

fnder은 플로팅을위한 배열이 아니라 구조체를 반환합니다. csapi이 문서를 참조 사용하기 위해

https://lost-contact.mit.edu/afs/cs.stanford.edu/pkg/matlab-r2015b/matlab/r2015b/help/curvefit/examples/cubic-spline-interpolation.html

: 당신은 ... ppval 또는 fnval 그것을 평가하는

plot1 = plot(x1, ppval(Speed1,x1)) 

문서 도구를 사용해야합니다 https://uk.mathworks.com/help/curvefit/csapi.html

% docs example 
bcs = csapi({x,y}, z); 
fnplt(bcs) 
+0

이 답변 주셔서 감사합니다! 나는 그것을 시도했지만 Speed1에서 2 차 함수를 얻고 싶기 때문에, Speed1의 내 플롯에서 상수 함수가 나왔다. 저는 Lifting1의 기능이 선형 적이기 때문에 Speed1을 'Fnder'와의 차별화를 통해 일정한 기능으로 만든다고 생각합니다. 'spline'대신 'csapi'로 만들었지 만. 'csapi'가 함수를 입방체로 만들었나요? 그 일에 대해 저를 도울 수 있기를 바랍니다. – Ozan

+0

@ 오잔 내 편집보기 – Wolfie