Clear Filters
Clear Filters

How to plot graph the values of given program

1 view (last 30 days)
I have this program and after running I ll get the values.
Now I need to plot all the values.
how to to that?
Help me.
Thank you
clc;
clear all;
A= [0 1 0 1 1 1 0 0
1 0 1 1 0 0 0 0
0 0 1 1 1 1 0 0
1 0 0 1 1 0 1 0
1 0 0 1 1 0 0 0
0 1 0 1 0 1 0 0
0 1 1 0 0 1 1 0
1 0 0 1 0 1 0 0] ;
N=64;
for n=0:(N-1);
B= circshift(A,n);
N = 64;
C= A==B ;
a=sum(C(C==1));
d= N-a;
R=zeros(n,1);
R=(a-d)/N;
disp(R);
end

Accepted Answer

Star Strider
Star Strider on 1 May 2019
Try this:
A= [0 1 0 1 1 1 0 0
1 0 1 1 0 0 0 0
0 0 1 1 1 1 0 0
1 0 0 1 1 0 1 0
1 0 0 1 1 0 0 0
0 1 0 1 0 1 0 0
0 1 1 0 0 1 1 0
1 0 0 1 0 1 0 0] ;
N=64;
nv = 0:(N-1);
R = zeros(size(nv));
for n=1:numel(nv)
B= circshift(A,nv(n));
N = 64;
C= A==B ;
a=sum(C(C==1));
d= N-a;
R(n) = (a-d)/N;
% disp(R);
end
figure
plot(nv, R)
grid
How to plot graph the values of given program - 2019 05 01.png

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!