Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need help with simple problem

  1. Apr 25, 2012 #1
    Programming in matlab. I have everything entered correctly, I just need help with iterating.
    The program is similar to the following:

    for i=0.1:0.99
    calculates x1
    for j=0.1:0.99
    calculates x2
    for k=0.1:0.99
    calculates x3
    for q=0.1:0.99
    calculates x4
    end
    end
    end
    end
    xtotal=x1*x2*x3*x4

    I want to display all xtotal value, but the catch is I need i+j+k+q=1.
    So for example i=.20,j=.25,k=.40,q=.15

    TIA
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted