Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Error in Matlab function block of Simulink?

Status
Not open for further replies.

ghasem_008

Full Member level 4
Joined
Feb 9, 2012
Messages
221
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
2,990
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?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top