Info

This question is closed. Reopen it to edit or answer.

I want a correct logic of my code.Also, I want the operations on my two plots i.e. 1.)error of two plots 2.)difference curve 3.) correlation.

3 views (last 30 days)
I want a correct logic of my code.
Also, I want the operations on my two plots i.e.
  1. error of two plots
  2. difference curve
  3. correlation.
true=multibandread('paris.lan',[512,512,7],'uint8=>uint8',128,...
'bil','ieee-le');
i1=true( :, :,1);
i2=true( :, :,2);
i3=true( :, :,3);
i4=true( :, :,4);
i5=true( :, :,5);
i6=true( :, :,6);
i7=true( :, :,7);
x(1)=double(i1(38,333));
x(2)=double(i1(38,334));
x(3)=double(i1(38,333));
x(1)=double(i1(38,333));
x(2)=double(i1(38,334));
x(3)=double(i1(39,333));
x(4)=double(i1(39,334));
y(1)=double(i1(486,115));
y(2)=double(i1(486,116));
y(3)=double(i1(487,115));
y(4)=double(i1(487,116));
avg1=((x(1)+x(2)+x(3)+x(4))/4);
avg2=((y(1)+y(2)+y(3)+y(4))/4);
a(1)=double(i2(38,333));
a(2)=double(i2(38,334));
a(3)=double(i2(39,333));
a(4)=double(i2(39,334));
b(1)=double(i2(486,115));
b(2)=double(i2(486,116));
b(3)=double(i2(487,115));
b(4)=double(i2(487,116));
avg3=((a(1)+a(2)+a(3)+a(4))/4);
avg4=((b(1)+b(2)+b(3)+b(4))/4);
m(1)=double(i3(38,333));
m(2)=double(i3(38,334));
m(3)=double(i3(39,333));
m(4)=double(i3(39,334));
n(1)=double(i3(486,115));
n(2)=double(i3(486,116));
n(3)=double(i3(487,115));
n(4)=double(i3(487,116));
avg5=((m(1)+m(2)+m(3)+m(4))/4);
avg6=((n(1)+n(2)+n(3)+n(4))/4);
p(1)=double(i4(38,333));
p(2)=double(i4(38,334));
p(3)=double(i4(39,333));
p(4)=double(i4(39,334));
q(1)=double(i4(486,115));
q(2)=double(i4(486,116));
q(3)=double(i4(487,115));
q(4)=double(i4(487,116));
avg7=((p(1)+p(2)+p(3)+p(4))/4);
avg8=((q(1)+q(2)+q(3)+q(4))/4);
r(1)=double(i5(38,333));
r(2)=double(i5(38,334));
r(3)=double(i5(39,333));
r(4)=double(i5(39,334));
s(1)=double(i5(486,115));
s(2)=double(i5(486,116));
s(3)=double(i5(487,115));
s(4)=double(i5(487,116));
avg10=((s(1)+s(2)+s(3)+s(4))/4);
avg9=((r(1)+r(2)+r(3)+r(4))/4);
h(1)=double(i6(38,333));
h(2)=double(i6(38,334));
h(3)=double(i6(39,333));
h(4)=double(i6(39,334));
j(1)=double(i6(486,115));
j(2)=double(i6(486,116));
j(3)=double(i6(487,115));
j(4)=double(i6(487,116));
avg12=((j(1)+j(2)+j(3)+j(4))/4);
avg11=((h(1)+h(2)+h(3)+h(4))/4);
f(1)=double(i7(38,333));
f(2)=double(i7(38,334));
f(3)=double(i7(39,333));
f(4)=double(i7(39,334));
g(1)=double(i7(486,115));
g(2)=double(i7(486,116));
g(3)=double(i7(487,115));
g(4)=double(i7(487,116));
avg13=((f(1)+f(2)+f(3)+f(4))/4);
avg14=((g(1)+g(2)+g(3)+g(4))/4);
% d=[300,400,500];
% r=[avg1,avg3,avg5];
% plot(d,r)
% hold on
% c=[avg2,avg4,avg6];
% plot(d,c)
% plot(d,c)
% d=[100,200,300,400,500,600,700];
% r=[avg1,avg3,avg5,avg7,avg9,avg11,avg13];
% plot(d,r)
% hold on
% c=[avg2,avg4,avg6,avg8,avg10,avg12,avg14];
% plot(d,c)
d=[100,200,300,400,500,600,700];
r=[avg1,avg3,avg5,avg7,avg9,avg11,avg13];
% plot(d,r)
%hold on
c=[avg2,avg4,avg6,avg8,avg10,avg12,avg14];
% plot(d,c)
figure, plot(d,r,'r',d,c,'g')
title('actual signals');
z=corr2(r,c);
figure, plot(d,z)
title('correlation of 2 signals'); %correlation
mm=r-c;
SSE=dot(mm,mm);
figure, plot(d,mm)
title('error of 2 signals'); % error
deltaSignal = double(abs(c - r));
percentageDifference = double(deltaSignal ./ r); % Percent by element.
meanPctDiff = mean(percentageDifference); % Average percentage over all elements.
figure, plot(deltaSignal,percentageDifference,'r',deltaSignal,meanPctDiff,'g')
title('% difference of 2 signals');
  10 Comments
Aarti Dwivedi
Aarti Dwivedi on 5 Jul 2018
Why can't you get the difference by just subtracting the variables from each other? I am assuming they are of the same size

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!