MATLAB Answers

0

Vary the Random number sampling time when it control over digital clock (built in Block) with different sampling time inside Embedded MATLAB function?

Asked by Viswanathan on 28 Aug 2014
Latest activity Commented on by Viswanathan on 1 Sep 2014
My code is (inside embedded MATLAB function)
function y=example(t)
y=rand(1,1)*t;
t is digital clock input (simulation block) with sampling time (1/1e6) the y also generate random number(uniform distribution) in 1/1e6 sampling time. But I need the sampling time output 'y' should be in (1/1e3) time.
How can i do it?

  0 Comments

Sign in to comment.

1 Answer

Answer by Kaustubha Govind on 29 Aug 2014

Depending on what you want, you can either set the sample-time of the MATLAB Function block to be 1e-3 as described in this answer, or simply insert a Rate Transition block after the MATLAB Function block, and set its Output port sample time to 1e-3.