repeating a constant with a +/-10%

Discussion in 'Programmer's Corner' started by shegmite, Apr 11, 2013.

  1. shegmite

    Thread Starter New Member

    Apr 5, 2013
    4
    0
    Please can anyone help on matlab codes to use to make a variable repeat itself but with a +/- 10% in the variable as it repeats from 1 to say 10 times of a program.
    Thanks
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,757
    4,800
    You probably want to generate a vector of random numbers (Matlab has several choices for how to control the distribution you get) and then fold those into your repeated value in some appropriate way (adding, multiplying, whatever).
     
Loading...