I have a grayscale image and I want this image as the three bands of an RGB image. In other words, each band of the new RGB image will be this grayscale image

That's what i tried so far:

```
gray_image=imread('image.pgm');
rgb_image=zeros(size(gray_image,1),size(gray_image,2),3);
rgb_image(:,:,1)=gray_image;
rgb_image(:,:,2)=gray_image;
rgb_image(:,:,3)=gray_image;

>> rgb_image(1,2,1)

 ans = 44

>> rgb_image(1,2,2)

 ans = 44

>> rgb_image(1,2,3)

ans = 44

```

You can see that the above code works, but when I do the following command:

```
imwrite(rgb_image,'rgb_image.ppm');

```

the image is all white. How to save the image with the right format?