How to plot graph the values of given program
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
N M Channabasavayya
el 1 de Mayo de 2019
Comentada: Star Strider
el 2 de Mayo de 2019
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
0 comentarios
Respuesta aceptada
Star Strider
el 1 de Mayo de 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
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!