ghasem_008
Full Member level 4
hi.
I have to write following equation by "matlab function block" of matlab-simulink.
my equation has two-expression and is periodic:
A(t) = 1; 0<t<Dmin*Ts
A(t) = 5; Dmin*Ts < t < Ts
priod:
A(t+Ts) = A(t)
i wrote this equation in "matlab function block". (I converted times (t) of the next periods to first period (0<t<Ts) and then write above equation:
%=====================
% MATLAB CODE in ""matlab function block":
function vc = fcn(t,a,Mg,Ts,Vm)
Dmin = 0.25;
m = floor(t/Ts); % to repeat next period similar to first period
t1 = t - m*Ts;
if t1 >= 0 && t1 <= Dmin*Ts
A = 1;
else
A = 5;
end
%=====================
but i received following error:
"Output argument 'A' is not assigned on some execution paths."
please say me that where is wrong?
I have to write following equation by "matlab function block" of matlab-simulink.
my equation has two-expression and is periodic:
A(t) = 1; 0<t<Dmin*Ts
A(t) = 5; Dmin*Ts < t < Ts
priod:
A(t+Ts) = A(t)
i wrote this equation in "matlab function block". (I converted times (t) of the next periods to first period (0<t<Ts) and then write above equation:
%=====================
% MATLAB CODE in ""matlab function block":
function vc = fcn(t,a,Mg,Ts,Vm)
Dmin = 0.25;
m = floor(t/Ts); % to repeat next period similar to first period
t1 = t - m*Ts;
if t1 >= 0 && t1 <= Dmin*Ts
A = 1;
else
A = 5;
end
%=====================
but i received following error:
"Output argument 'A' is not assigned on some execution paths."
please say me that where is wrong?