2017-01-31 22 views
1

3次スプライン補間の導出関数をどのようにプロットすることができますか?私は自分のコードでどのようにしたのかを示します。エラーがあった:function_MTU4000_Realのプロット 無効第二のデータ引数 エラー(線90) plot1 =プロット(X1、SPEED1、 'B')を使用して3次スプライン補間の導出関数をどのようにプロットできますか?

エラー。

%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は、プロットの配列ではなく構造体を返します。あなたは...それを評価するために

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

ドキュメントppvalまたはfnvalを使用する必要があります:csapiを使用するために

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

をドキュメントを参照してください。 https://uk.mathworks.com/help/curvefit/csapi.html

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

あなたの答えをありがとう!私はそれを試みましたが、一定の関数がスピード1の私のプロットに現れました。これは間違っています。私はスピード1で2次関数を得たいからです。私は、Lifting1の機能は線形であるため、Speed1は 'Fnder'との差別化によって一定の機能を果たしますが、スプラインの代わりに 'csapi'で作成しました。 'csapi'は関数を立方体にしますか?あなたが私に助けてくれることを願っています。 – Ozan

+0

@Ozan自分の編集を参照 – Wolfie

関連する問題