The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: matrix generation of random numbers
Replies: 8   Last Post: Jan 17, 2014 5:32 PM

Advanced Search

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

Posts: 14
Registered: 6/10/13
Re: matrix generation of random numbers
Posted: Jan 17, 2014 4:36 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

TideMan <> wrote in message <>...
> On Friday, January 17, 2014 8:17:14 PM UTC+13, Narayanan wrote:
> > I need to generate a matrix of size 3*20. It should contain random numbers from 0.5 to 10 rounded off to values of 0.25. example numbers acceptable are 0.75, 6.25,8.5,4.0 and not values like 1.2, 2.36, 5.4, 8.19. Kindly hep me in this regard.
> So, show us what you've tried and where you got stuck, then maybe we can help.
> Did you read:
> help rand
> ?
> It has an example of how to generate numbers between a and b.
> And:
> help round
> will also be helpful.

I have used
B = randi([50,1000],3,20). It is generating a matrix of 3*20 with values between 50 and 1000. But if I change it to
B = randi([0.5,10],3,10) I get an error as "IMIN and IMAX must be integer values".

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.