フィルターのクリア

how to solve this error,??? Input argument "alpha" is undefined. Error in ==> newvod3RL at 6 alphaINT = (real(alpha)>0) .* ceil(real(alpha)) + ...

3 ビュー (過去 30 日間)
function out = vod3RL(t, in, alpha)
% function out = vod3RL(t, in, alpha)
% Variable order derivative, Riemann-Liouville definition, variant 3.
% Duarte Valrio, 2009.
alphaINT = (real(alpha)>0) .* ceil(real(alpha)) + ...
( (real(alpha)==0) & (imag(alpha)~=0) ); % number of differentiations to perform
alphaRES = alpha - alphaINT; % residue of alphaINT with negative real part only
% negative differentiation (i.e. integration) performed
out = zeros(size(t));
for k = 2 : length(t) % the first integral is always 0, since no time elapsed, hence no need to make k = 1...
tau = t(1:k);
integrand = (t(k) - tau).^(-alphaRES(k - (1:k) + 1) - 1) ./ gamma(-alphaRES(k - (1:k) + 1)) .* in(1:k);
if any(~isfinite(integrand)) % eliminate eventual inf and nan points
integrand(find(isinf(integrand))) = 0;
integrand(find(isnan(integrand))) = 0;
end
integrand(1) = 2*integrand(1); % this is to handle steps properly with Caputo's definition
% (otherwise the first point only has half the influence and the result comes halved all the way to the end)
out(k) = sum( (integrand(1:end-1)+integrand(2:end))/2 .* (tau(2:end)-tau(1:end-1)) );
end
% necessary differentiations performed
while 1
if sum(alphaINT) == 0, break, end % exit condition
temp = diff([0; out]) ./ [t(2)-t(1); diff(t)]; % this is to handle steps properly
out = out.*(alphaINT==0) + temp.*(alphaINT~=0);
alphaINT = (alphaINT-1) .* (alphaINT~=0); % take away one integration
end

採用された回答

Geoff Hayes
Geoff Hayes 2014 年 11 月 27 日
naeem - how are you calling this function, vod3RL? Are you supplying three inputs as
result = vod3RL(t,in,alpha);
where t, in, and alpha are local variables that have been initialized to something? The error message is telling you that you haven't passed in (at least) the third input parameter, and so you must define it (and the other two) and pass them as arguments/inputs to the function.
  2 件のコメント
naeem
naeem 2014 年 11 月 30 日
i am supplying three inputs as
alpha=0.9
in=0.5
t=1
and now i am getting an error of
??? Attempted to access t(2); index out of bounds because numel(t)=1.
Error in ==> vod1RL at 30
temp = diff([0; out]) ./ [t(2)-t(1); diff(t)]; % this is to handle steps properly
Geoff Hayes
Geoff Hayes 2014 年 11 月 30 日
Given the code, t must be a vector and not a scalar. For example,
t = 1:10;

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by