creating table in matlab of elliptic curve points
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Muhammad Sohail Abid
el 11 de Jul. de 2018
Comentada: Walter Roberson
el 13 de Jul. de 2018
I get the points of elliptic curve and then when I try to convert that 1D array into 2D and try to make a table some error appears need help here is an example of code
if true
% code
end
disp('y^2 = x^3 + 5376x + 2438 mod 123457')
a=0:123456
left_side = mod(a.^2,123457);
right_side = mod(a.^3+5376*a+2438,123457);
points = [];
for i = 1:length(right_side)
I = find(left_side == right_side(i));
for j=1:length(I)
points = [points;a(i),a(I(j))];
end
end
plot(points(:,1),points(:,2),'ro')
set(gca,'XTick',0:1:123456)
set(gca,'YTick',0:1:123456)
grid on;
Z=reshape(points,[256,482])
2 comentarios
Steven Lord
el 11 de Jul. de 2018
What is the full text of the error message you receive when you run that code, and on which line does the error occur? Show us all the text displayed in red (and if you receive any warnings in orange, show us the full text of those warning messages as well.)
Respuesta aceptada
Walter Roberson
el 12 de Jul. de 2018
You are asking to reshape a 123387 by 2 array into a 256 x 482 array. The number of elements in the array is not divisible by 256 or 482 -- it is just slightly less than 482 * 256 * 2
6 comentarios
Walter Roberson
el 13 de Jul. de 2018
Sorry, I cannot seem to find words that make it sufficiently clear to you that you have 256 times 482 times 2 data points that you are trying to reshape into a 256 times 482 times 1 array.
Imagine that you have an array
A B
C D
E F
G H
I J
K L
and you ask to reshape() it to be a 3 x 2 array. Now, the number of rows you have is 6, and 6 is 3 x 2, so you think you should be able to do the reshape. But you cannot do that, because the 3 x 2 array you would end up would have only 6 total entries, but the 6 x 2 array that you start with has 12 total entries. You cannot make a 3 x 2 array out of the 6 x 2 array except by throwing away half of the data.
Más respuestas (0)
Ver también
Categorías
Más información sobre Special Functions 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!