Generating numbers within a range

Home Forums Matlab Generating numbers within a range

This topic contains 1 reply, has 2 voices, and was last updated by  cK 10 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #300

    Greatness
    Participant

    How can we write a Matlab code which converts or scale-up numbers within the range of 0 & 1 to a lower and upper limit? The lower and upper limit can be any number not necessarily 0 & 1. It can be tested with lower limit: -10, and upper limit 10.

    #301

    cK
    Keymaster

    Say you have a vector x = [6 8 3 22 -3 -20 0 1 10 5].
    To create an upper limit of 10 you can do y = min(x,10).
    Likewise to create a lower limit of -10, you do y = max(x,-10).

    • This reply was modified 10 years, 8 months ago by  cK.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.