creating table in matlab of elliptic curve points
2 ビュー (過去 30 日間)
古いコメントを表示
Muhammad Sohail Abid
2018 年 7 月 11 日
コメント済み: Walter Roberson
2018 年 7 月 13 日
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!