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:
Plot 2-Variables ...strange output

Subject: Plot 2-Variables ...strange output

From: Twilighter

Date: 12 Jun, 2011 13:34:02

Message: 1 of 5

i'm having 2 variables Y1 & Y2 which i need to plot them against X

but as i plot everyone separately it works fine

only when i plot them together, i get wierd output

see the picture here ....

the two figures are plotted using the same data table shown in the figure, no change

the red line which is the Threshold (Y2), becomes a straight line which its + points are exactly the same values of X .... see the table in the image

here is my Code

Y = [Y1 Y2]; % size 4x2

  X =AttacksValue.Value;
  X=X'; % size 4x1
% plotting Y1 & Y2 Against X

title ('Gaussain Attack');
xlabel ('Gaussian Noise Variance');
ylabel ('Response Detector');
legend('Image Response','Threshold');

% that for plotting only the Threshold Against X

title ('Gaussain Attack');
xlabel ('Gaussian Noise Variance');
ylabel ('Response Detector');

why do i get this weird plot ?

thanx for your responses

Subject: Plot 2-Variables ...strange output

From: ImageAnalyst

Date: 12 Jun, 2011 13:39:22

Message: 2 of 5

Because they're different scales. Y1 goes up to 2*10^13 and Y2 is
like .003 so of course it shows up as a flat line when you plot them
both with the same vertical axis scale.

You want to use plotyy() instead so that the two curves are plotted
each with their own Y scale.

Subject: Plot 2-Variables ...strange output

From: Twilighter

Date: 12 Jun, 2011 19:07:02

Message: 3 of 5

Thank you so much yes i got it ... i appreciate it

but can you help me in this too ... it's regarding the Y1 & Y2 values ....
it seems the that Image response value isn't supposed to be that big

here is my Code ... in how i get Y1 & Y2

i have a watermarked image, and i add additive gaussian noise with zero mean & variance value is the X value & on it ...
so i get Y1 & Y2 which are the Image Response & the threshold respectively

side info is the Watermark image


% initalize message to all ones

[cA1,cH1,cV1,cD1] = dwt2(watermarked_image,'haar');

cH1 = reshape(cH1,1,256*256);
cV1 = reshape(cV1,1,256*256);

% The computed detection value ( Correlation between the watermark image & the subbands which i actually embedded the watermark in them )

ccH1= zeros(1,256*256);
ccV1= zeros(1,256*256);

for (KK=1:length(message_vector))

P= (1/3*256*256)*(ccH1+ccV1);
Ptotal =abs(sum(P));
P_img = reshape(P,256,256);
title('Image Correlation')

% Other Method to perform correlation between Watermark & watermarked Image
% nearly the same value as Ptotal
cross_correlation_h = xcorr(cH1,sideinfo_h)
cross_correlation_v = xcorr(cV1,sideinfo_v)
cross_correlation = (1/3*256*256)*((cross_correlation_h+cross_correlation_h)/2);
cross_correlation = sum(cross_correlation);

so now that's how i calculate the threshold too

% The computed Threshold value value
ccHThr= zeros(1,256*256);
ccVThr= zeros(1,256*256);
for (KK=1:length(message_vector))

T1=(1/(3*256*256)^2) *sum(ccHThr+ccVThr)
T = 3.97*sqrt(2*T1)

here is a link to the equations implement here ....

what i need to know is it normal to have way far values between threshold & the Image Response ??

am i correctly interpreting those equations ?
they are simple but i'm just beginner i may have not put them correct

i appreciate your guidance through this

Subject: Plot 2-Variables ...strange output

From: ImageAnalyst

Date: 12 Jun, 2011 19:40:22

Message: 4 of 5

Sorry, no. I see dwt2 being called and I don't have the wavelet
toolbox, so I know I shouldn't even try. It shouldn't be difficult to
figure out, assuming you know how to use the debugger.

Subject: Plot 2-Variables ...strange output

From: Twilighter

Date: 12 Jun, 2011 20:00:21

Message: 5 of 5

thank you

i dont have an error

i'm just asking about the output of those two equations ... are they correctly implemented ... or i mis-understood implementing them

you could consider the Wavelet coefficient is another image not decomposed image

but anyway thanx :)

Tags for 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