Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
name of the function that plot this noise

Subject: name of the function that plot this noise

From: ahmed

Date: 5 Feb, 2012 08:43:10

Message: 1 of 5

Hi,
Please, what the name of the function that plot this noise, I want to understand the work of this function, what is the appropriate titles of the horizontal and vertical coordinates in figure(2) after plot the noise?

step = 1+[ones([32 64]) ; zeros([32 64])];
noise = 0.1 * randn(size(step));
im = (step + noise);
im = double(im);
figure(1), clf;
subplot(1,2,1); imshow(im,[0,3]);
figure(2); clf;
plot(im(:,32));

Subject: name of the function that plot this noise

From: Sadik

Date: 5 Feb, 2012 10:15:10

Message: 2 of 5

Hello Ahmed,

step = 1+[ones([32 64]) ; zeros([32 64])];
% Make a 64x64 image with first 32 rows equal to 2 and second 32 equal to 1.

noise = 0.1 * randn(size(step));
% Generate gaussian noise with standard deviation equal to 0.1. This noise image is of the same size as the image above.

im = (step + noise);
% Now add this noise to the original image and obtain the noisy image called im.

im = double(im);
% This is for casting the data to double, but unnecessary because the data is already of type double.

figure(1), clf;
% Open up Figure 1. clf is for clearing the figure if there is anything that remains from a previous run.

subplot(1,2,1); imshow(im,[0,3]);
% Make two axes side by side in the figure and use the first one for showing the noisy image.

figure(2); clf;
% Here, it should have said subplot(1,2,2) rather than figure(2). If you use subplot, they will be on the same figure [Figure 1] side by side.

plot(im(:,32));
% Plot the 32nd column of the noisy image. You can see that the first 32 elements will be 2+noise [noisy observations around 2] and the second 32 elements will be 1+noise [There are 64 pixels in a column].

x-axis could be labeled as 'Image Row' using the command xlabel('Image Row'), and y-axis could be labeled as '32nd Column' by ylabel('32^n^d Column').

Best.

Subject: name of the function that plot this noise

From: ImageAnalyst

Date: 5 Feb, 2012 14:26:18

Message: 3 of 5

On Feb 5, 3:43 am, "ahmed " <ah_...@yahoo.com> wrote:
> Hi,
> Please, what the name of the function that plot this noise, I want to understand the work of this function, what is the appropriate titles of the horizontal and vertical coordinates in figure(2) after plot the noise?
>
> step = 1+[ones([32 64]) ; zeros([32 64])];
> noise = 0.1 * randn(size(step));
> im = (step + noise);
> im = double(im);
> figure(1), clf;
> subplot(1,2,1); imshow(im,[0,3]);
> figure(2); clf;
> plot(im(:,32));
--------------------------------------------------------
To add titles to the axes, add these lines:
xlabel('Pixel Column', 'FontSize', 16);
ylabel('Gray Level', 'FontSize', 16);
title('Row 32 of Image', 'FontSize', 16);

Subject: name of the function that plot this noise

From: Sadik

Date: 7 Feb, 2012 08:34:10

Message: 4 of 5

Are you sure? It is not the 32nd row, it is the 32nd column.

Best.

Subject: name of the function that plot this noise

From: ImageAnalyst

Date: 7 Feb, 2012 12:35:11

Message: 5 of 5

On Feb 7, 3:34 am, "Sadik " <sadik.h...@gmail.com> wrote:
> Are you sure? It is not the 32nd row, it is the 32nd column.
>
> Best.

-----------------------------------------
You are correct. Should be
xlabel('Row of Image', 'FontSize', 16);
ylabel('Gray Level', 'FontSize', 16);
title('Column 32 of Image', 'FontSize', 16);

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us