Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am plotting a pattern as illustrated in link shown below. I want to create an image of fixed size.

The whole image should be filled by repeating unit blocks which consist of black and green regions. The width of a unit block and its black region change from 0 to 100 (or even larger values), and from 1 to 0, respectively.

The ratio between a black region and a unit block is given as 1.055^(-lambda0). More preferably, the width of a unit block changes randomly from Lambda0(1 - errorfactor) to lambda0(1 + errofactor), so that the average value of the unit blocks are still lambda0 but each individual block may vary slightly.

diagram

share|improve this question
1  
Please show us what have you tried. It seems an easy application of Rectangle[] ... –  belisarius Jun 17 '13 at 1:42
    
Thank you, Belisarius. That Rectangle[] helped a lot and it is enough. I have tried a few methods, such as plotting parallel lines, arrays, squarewave, but not the Retangle[]! I didn't even now that we have this command. Once you gave me this clue, I got what I had expected. I will work on the remaining part that is to make the pattern a little bit irregular of certain fluctuations rather than perfectly uniform. Would you suggest again some possible commands? (I don't know how to copy my codes and image to this tiny input box,they all went messy when I just did that –  Andew Jun 17 '13 at 5:41

1 Answer 1

w = 1.055^-λ;
AR = 20;
h = λ*AR*w;
λ = 15;
λmax = 100;
Graphics[{EdgeForm[Black], Blue,
  Table[{Black, Rectangle[{j, 0}, {j + λ, h}], 
         Green, Rectangle[{i, 0}, {i + w*λ, h}]}, 
    {j, 0, λmax, λ}, {i, 0, λmax, λ}
  ]}, 
 AspectRatio -> 1/GoldenRatio, 
 FrameLabel -> {"Width  (μm)", "Height", "λ = 15"}, 
 Frame -> True, FrameStyle -> Thick, 
 LabelStyle -> Directive[{Black, Large, Bold}]]

result

share|improve this answer
    
Sorry, the solution seems ugly because I don't know how to paste the code as it looks in Mathematica. –  Andew Jun 17 '13 at 16:37
    
Add 4 spaces to the beginning of each code line, or select the code block and hit ctrl+k –  Corey Kelly Jun 17 '13 at 16:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.