Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Matrix variable with parametric elements
Replies: 10   Last Post: Dec 26, 2012 5:38 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Michael Doukas

Posts: 12
Registered: 12/26/12
Re: Matrix variable with parametric elements
Posted: Dec 26, 2012 9:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Roger Stafford" wrote in message <kbf08g$g99$1@newscl01ah.mathworks.com>...
> - - - - - - - - - - -
> Let c be a row vector which gives the initial value of each column integer range together with a final element which is 1 greater than the end of the last range. (In your example it would be as below.)
>
> c = [0,3,5,8,12,23,25,27,40,53];
> n = length(c)-1;
> m = 40;
> M = floor(repmat(diff(c),m,1).*rand(m,n))+repmat(c(1:n),m,1);
>
> M is your desired matrix.
>
> Roger Stafford


Thank you very much!
This is exactly what I was looking for!

Regards,
Mike



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.