run:=Module[
{cor1,cor2,x1,x2,y1,y2},
cor1=0.5;cor2=0.4;
While[
cor1!=cor2,
cor1 =Round[Correlation[x1 = RandomReal[10, 10], y1 = RandomReal[10, 10]],0.001];
cor2 =Round[Correlation[x2 = RandomReal[10, 20], y2 = RandomReal[10, 20]],0.001];
];
(*Print[{cor1,cor2}];*)
Show[
ListPlot[Thread[{x1, y1}], Frame -> True,PlotStyle->Red] ,
ListPlot[Thread[{x2, y2}], Frame -> True]
]
]
I have started with some basic lines, which will generate some random points. Call the {x1,y1} dataset 1 and {x2,y2} the dataset 2.
I then want to Catch
the two set when they have similar Correlation
, for example, both are 0.43 to 2 decimal places, then plot them side by side.
Or -0.453 to 3 decimal places, then plot them side by side.
What's the best way to do it?
Thanks.