I want to find all squares in big divided square. But even I have a outline of code. I can't finish this. Could you help me to complete this code?
clear all; clc;
x = [0,2,3,4,5,6,8];
y = [0,2,3,4,5,6,8];
figure(1);
sketchgrid;
filename
VideoWriter
open
for x_i = 1:6
for y_i = 1:6
...
for x_i2 = x_i+1:7
...
if find(y==y3)
...
end
end
end
end
close
function sketchgrid
hold on;
plot([0 0],[0 8],'k-')
plot([2 2],[0 8],'k-')
plot([3 3],[0 8],'r-')
plot([4 4],[0 8],'k-')
plot([5 5],[0 8],'r-')
plot([6 6],[0 8],'k-')
plot([8 8],[0 8],'k-')
plot([0 8],[0 0],'k-')
plot([0 8],[2 2],'k-')
plot([0 8],[3 3],'r-')
plot([0 8],[4 4],'k-')
plot([0 8],[5 5],'r-')
plot([0 8],[6 6],'k-')
plot([0 8],[8 8],'k-')
axis square;
axis([-1 9 -1 9]);
set(gca,'XTick',[0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
set(gca,'YTick',[0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
return
image is example of completed code.

 Akzeptierte Antwort

KSSV
KSSV am 29 Nov. 2016

0 Stimmen

x = [0,2,3,4,5,6,8];
y = [0,2,3,4,5,6,8];
[X,Y] = meshgrid(x,y) ;
plot(X,Y,'k') ;
hold on
plot(X',Y','k')
Get the successive distances of points in (X,Y) which ever have equal distances they are squares.

Weitere Antworten (0)

Kategorien

Mehr zu Data Exploration finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 29 Nov. 2016

Beantwortet:

am 29 Nov. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by