2

I've managed to create red, green and blue noise in Matlab using imagesc(cat(3,zeros(10,20),rand(10,20),zeros(10,20))). I'm now trying to combine individual colors to make yellow. But when I add multiple rand's together in the cat, both those colors appear. How can I fix that?

2
  • 3
    You got me really startled there - usually somecolor noise refers to frequency components of a distribution (see en.wikipedia.org/wiki/Colors_of_noise) and I never heard of "yellow noise" before... Oct 16, 2013 at 14:36
  • @TobiasKienzler I had the same thought as well, but (as a hint to future readers) the use of imagesc gave away that we are dealing with images rather than sounds or distributions. Oct 17, 2013 at 10:19

2 Answers 2

6

For yellow, use the same values in the R and G components:

imagesc(cat(3,repmat(rand(10,20),[1,1,2]),zeros(10,20)))
4

Here is an intuitive way to do it:

Noise = rand(10,20);

One color example:

imagesc(cat(3,zeros(10,20),Noise,zeros(10,20)))

Two color example:

imagesc(cat(3,zeros(10,20),Noise,Noise))

This is a little easier to apply than the solution by @Luis if you want color 1 and 3 to have noise rather than only 2 adjacent colors. Also I don't know if it makes sense, but it allows you to get different colors by scaling the noise with a constant.

1
  • Thank you, I'll accept this as an answer because it is the most dynamic
    – Joren
    Oct 16, 2013 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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