Error with randsrc in matlab function in simulink.

2 views (last 30 days)
Dear friends. I have problem with it. I have input is a. a is a time time series with 12 periods and each period has a value. a= [1 2 3 4 5 0 0 0 6 7 8 9] After that, i will calculate value base on a. (a, 5*a, and 10*a) now i want to pick value output base on probality ( 0.1, 0.4 and 0.5) So i used randsrc. But the output only 2 value. and i debug it. I see matlab pick value of a not by time by time. They pick a =1, after that move to period 5. not period 2. After that stop.
function y1 = choose(a)
coder.extrinsic('randsrc');
y1=1;
y1 = randsrc(1,1,[a a*5 a*10; 0.1, 0.4, 0.5])
Now i want value of y1 also array by time series [value1 ... value12]

Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!