how to use a variable in finite field
이전 댓글 표시
sym a;
I want y=gf(3,8)*a, but it did not work.
댓글 수: 4
% Create a Galois field array
g = gf(3, 8);
disp('Galois field array:');
disp(g);
% Multiply the Galois field array by an integer
y = g * 2;
disp('Result after multiplication:');
disp(y);
ling
2024년 4월 6일
ling
2024년 4월 6일
Manikanta Aditya
2024년 4월 6일
Yeah
답변 (2개)
g = gf(3, 8)
whos g
g is a gf object. But g is not compatible for multiplication by a symbolic parameter. These are two independent (and unfortunately, incompatible) toolboxes. They don't talk to or with each other. This is why when you do try to multiply g with a symbolic object, it fails.
syms a
g*a
As the error message says, the only things you can multiply a gf object by are in that list of numeric classes. A sym is not one of the allowed classes for that operation.
You could possibly write your own set of tools that would work as you wish, essentially rewriting the gf class. Since a sym can take on any value, and it MUST be discrete for that operation to make any sense at all, it might take some work on your part to do so in a valid way.
How about something along these lines?
y = @(a) gf(3,8)*a;
y(1)
y(2)
카테고리
도움말 센터 및 File Exchange에서 Error Detection and Correction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!