Hey there! Sign in to join this conversationNew here? Join for free

How to generate a random matrix using matlab? Watch

    • Thread Starter
    Offline

    3
    ReputationRep:
    How would i generate a 5x5matrix of random real numbers between the values 2 and 5.5?
    • Very Important Poster
    Online

    21
    ReputationRep:
    (Original post by jlf98)
    How would i generate a 5x5matrix of random real intergers between the values 2 and 5.5?
    I would break this into two problems:

    1. Generating a random matrix. A quick google search shows that the rand function does this. You'd want rand(5) or rand(5,5) - both are the same.

    https://edoras.sdsu.edu/doc/matlab/t.../ref/rand.html

    2. Getting the numbers in this to be an integer between 2 and 5.5.

    The page above gives you a nice example in its explanation of the rand function, hint hint.
    You'd just need one more step after you've tried this (try it, see what you get in matlab and think of how to complete the function)
    Offline

    17
    ReputationRep:
    (Original post by jlf98)
    How would i generate a 5x5matrix of random real intergers between the values 2 and 5.5?
    (Original post by Kevin De Bruyne)
    2. Getting the numbers in this to be an integer between 2 and 5.5.
    I think we need to be questioning the very concept of a random integer between 2 and 5.5. (Obviously mathematically there's no problem, but the problem statement raises eyebrows, at the very least).
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Did TEF Bronze Award affect your UCAS choices?
    Useful resources

    Make your revision easier

    Maths

    Maths Forum posting guidelines

    Not sure where to post? Read the updated guidelines here

    Equations

    How to use LaTex

    Writing equations the easy way

    Student revising

    Study habits of A* students

    Top tips from students who have already aced their exams

    Study Planner

    Create your own Study Planner

    Never miss a deadline again

    Polling station sign

    Thinking about a maths degree?

    Chat with other maths applicants

    Can you help? Study help unanswered threads

    Groups associated with this forum:

    View associated groups
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.