Spline and interpolation?
이전 댓글 표시
(I'm very new to programming). I want my code to give me the consumption for every speed. So when I for example write consumption(40) in the command window it gives me the consumption for when the speed is 40 km/h.
This is my code so far:
function c = consumption(v)
load roadster.mat;
x = 2:2:200;
y = consumption_Whpkm;
xx=2:200;
pp=spline(x,y,xx);
plot(xx,spline(x,y,xx),'k-',x,y,'ro')
end
채택된 답변
추가 답변 (1개)
Image Analyst
2018년 4월 22일
0 개 추천
You need to use v inside your function. Please see attached spline demo.
카테고리
도움말 센터 및 File Exchange에서 Splines에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!