Is there a way to get the pattern sequence form a generated graph?
1 view (last 30 days)
The aim is to obtain a unique value (also know as the order in Shor's Algorithm) from the graph produced. The graph contains discrete values and depending on the parameters T and M, it will change. For example, the current parameters gives 4 different unique points before repeating it self (A pattern of repeating unique) I would like to know how I can obtain the no. of unique points it contains (not the each individual points values) from the graph. So from this graph I have attached, there is 4 unique points on the x-axis before repeating it self and I would like to know some lines of code that would give me the value 'N = 4' from the graph. If that makes sense?
%% Only works for 4 orders properly!!
T = 7; % Seed
P = 128; %input("Please Enter the Bit size: "); % Bit 128, 256, 512, 1024
M = 100; %input('Please Enter the Number to be Factored: '); % Number to be factorized
t = sym(1):1:sym(P); % Signal duration/length
fncT = (T.^t) - floor(T.^t/M)*M; % Alternative version to mod(a,b)
% Fast fourier Transforms 1-D
% Rearranges 'fncT' by shifting the zero-frequency component to the centre of the array
FTsignal = fft(double(fncT) - mean(double(fncT)))/numel(double(fncT));
A = fftshift(FTsignal); % Computes duscrete fourier transform of A using fft algorithm
A_mag = abs(A.*A); % Returns absolute value of each element
% Plotting Different Graphs
title('Register in superposition state')
A_ax2 = nexttile; % Creates an axes object and inputs the graph into the next empty tile of the layout
xlim([0 P+1]) % Sets the x axis limit
A_ax3 = nexttile;