From: trung trinh on
i have a test for a program simulink. below the picture
http://i405.photobucket.com/albums/pp133/trungkstn/ql_2136abe693e125e91f4e050803b61a4b.gif

and i use bb.m for MATLAB function.and below it is code of bb.m

function f = bb(t)
syms x;
a = sin(x)*cos(t)
f = int(a,0,1);

although if f is function of variable t but simulink report a error. How to deal with this problem ?

Thank for assistance
From: Steven Lord on

"trung trinh" <trungkstn(a)gmail.com> wrote in message
news:hq1lgk$9lm$1(a)fred.mathworks.com...
>i have a test for a program simulink. below the picture
> http://i405.photobucket.com/albums/pp133/trungkstn/ql_2136abe693e125e91f4e050803b61a4b.gif
>
> and i use bb.m for MATLAB function.and below it is code of bb.m
>
> function f = bb(t)
> syms x;
> a = sin(x)*cos(t)
> f = int(a,0,1);
>
> although if f is function of variable t but simulink report a error. How
> to deal with this problem ?

bb should return a double array. Add this as the last line of the function:

f = double(f);

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ