フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

whenever i run the program it says 'Error using interpDriveCycle (line 10) Not enough input arguments. '

1 回表示 (過去 30 日間)
MAYANK GIRI
MAYANK GIRI 2016 年 7 月 12 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
function [a,s] = interpDriveCycle(t, v)
%interpDriveCycle Produce accelerations that go with drive cycles.
% a = interpDriveCycle(t, v) produces a constant acceleration to go with
% the drive cycle data described by (t, v). A constant acceleration is
% assumed between each point in the cycle.
% Check input parameters:
assert(isvector(t), 'interpDriveCycle:inputsNotVectors', ... 'Inputs not vectors: t and v must be row or column vectors.');
sizeT = size(t);
sizeV = size(v);
sizesAreEqual = isequal(sizeT, sizeV);
assert(sizesAreEqual, 'interpDriveCycle:inputSizesNotEqual', ... 'Input sizes not equal: t and v must have the same dimensions.');
% Convert to column vector form:
t = t(:);
v = v(:);
% Calculate the accerations:
deltaT = [t(2:end) - t(1:end-1); 1];
deltaV = [v(2:end) - v(1:end-1); 0];
a = deltaV ./ deltaT;
% Calculate the displacements.
s = zeros(size(t));
for iPoint = 1:numel(s)-1
thisS = s(iPoint);
thisV = v(iPoint);
thisA = a(iPoint);
deltaT = t(iPoint+1)-t(iPoint);
nextS = thisS + thisV * deltaT +0.5*thisA*deltaT*deltaT;
s(iPoint+1)= nextS;
end
a = reshape(a, sizeT);
s = reshape(s, sizeT);
end
  1 件のコメント
Robert Fennis
Robert Fennis 2016 年 7 月 12 日
Same as in the previous case. What are you trying to do?

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by