creating table in matlab of elliptic curve points
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Steven Lord
2018-7-11
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.)
采纳的回答
Walter Roberson
2018-7-12
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 个评论
Walter Roberson
2018-7-13
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Special Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!