question about a script

edited March 2009 in Science & Tech
Hi,
I have this equation y=ND*DE.

I want to make a loop with this logic:
For example:
Give limits of ND between 5e9-1e12: 6e9,3e10
Give limits of DE between 0.05-0.5: 0.1,0.3

Then the loop i want to calculate this:
6e9 0.1 y=the result
7e9 0.13 y=the result
8e9 0.16 y=the result
9e9 0.19 y=the result
1e10 0.22 y=the result
2e10 0.25 y=the result
3e10 0.28 y=the result

Other example:
Give limits of ND between 5e9-1e12: 1e11,5e11
Give limits of DE between 0.05-0.5: 0.1,0.5
1e11 0.1 y=the result
2e11 0.2 y=result
3e11 0.3 y=result
4e11 0.4 y=result
5e11 0.5 y=result

I would be grateful if you can post your opinions of how can i do that!
Thank you very much!!

Comments

  • shwaipshwaip bluffin' with my muffin Icrontian
    edited March 2009
    use elementwise vector multiplication

    a .* b multiplies all the individual elements in a and b.
  • edited March 2009
    thank you for your help.
    One other question.Does anyone knows how can i write this in matlab?
    y=
    4e11
    5e11
    6e11
    7e11
    8e11
    9e11
    1e12
    2e12

    I tried this y=(4e11:1e11:2e12).' but is wrong.
    It gaves me these results:
    4e11
    5e11
    6e11
    7e11
    8e11
    9e11
    1e12
    1.1e12
    1.2e12
    .
    .
    1.9e12
    2e12

    and not the results which i want!!
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited March 2009
    help logspace
Sign In or Register to comment.