matlab gfdeconv函数源码

时间: 2023-12-06 11:55:14 浏览: 50
GFDECONV 函数是 MATLAB 中用于通用分式函数的除法的函数。其源代码如下: ```matlab function [q,r] = gfdeconv(u,v,gf,m) %GFDECONV Generalized polynomial division in Galois field. % [Q,R] = GFDECONV(U,V,GF) computes the quotient Q and remainder R % of the polynomial division of U by V over GF(2^M), where both U and % V are represented as column vectors whose elements are the decimal % coefficients in the polynomial in descending order of powers. GF is % the field ID string or the prime polynomial for binary fields. If GF % is a string, it must be one of 'cyclic', 'trun', 'prime', or 'custom'. % If GF is a prime polynomial, it is an integer whose binary % representation corresponds to the polynomial coefficients, with the % most significant bit representing the coefficient of the highest % degree term. The degree of V must be less than or equal to the degree % of U. The degree of Q is the difference between the degrees of U and % V. The remainder R has degree less than that of V. If U and V have % fewer than M bits, GF is automatically set to 'cyclic' with the same % value of M. % % [Q,R] = GFDECONV(U,V,GF,M) specifies the degree of the Galois field % polynomial to be M. M must be a positive integer. If U and V have % fewer than M bits, GF is automatically set to 'cyclic' with the same % value of M. % % Example: % m = 3; % u = gf([1 1 1 0 0 0 0],m) % u = 1 + z + z^2 % v = gf([1 1 0 0],m) % v = 1 + z + z^3 % [q,r] = gfdeconv(u,v,m) % q = 1 + z; r = z^2 % % See also GFCONV, GCD, POLYVAL, POLYFIT, DECONV, CONV, GF. % Reference: % [1] P. V. Kumar, T. L. Casavant, J. P. Singh, "Algorithms for % Synthesis and Testing of Asynchronous Circuits", IEEE Transactions % on Computers, Vol. 41, No. 11, pp. 1372-1394, November 1992. % % Copyright 1992-2015 The MathWorks, Inc. % Validate input arguments. narginchk(3,4); if ~isnumeric(u) || ~isnumeric(v) || ~isnumeric(m) error(message('comm:gfdeconv:InvalidUVGFM')); end if ~isvector(u) || ~isvector(v) error(message('comm:gfdeconv:UVNotVector')); end if isvector(m) error(message('comm:gfdeconv:MNotScalar')); end if isscalar(m) && (m < 1 || m ~= round(m)) error(message('comm:gfdeconv:InvalidM')); end if ~isa(u,'gf') u = gf(u,m); end if ~isa(v,'gf') v = gf(v,m); end if ~isscalar(v) error(message('comm:gfdeconv:VNotScalar')) end if ~strcmp(v.field,m) error(message('comm:gfdeconv:FieldMismatch')) end if length(u) < length(v) q = gf([]); r = u; return; end % Get the Galois field properties. if ischar(m) if strncmpi(m,'custom',6) if strcmpi(m,'custom') error(message('comm:gfdeconv:CustomPolyMissing')); end gfchar = m(8:end); gfdegree = gfgetdegree(gfchar); gfprim = gfgetprim(gfchar); gfpower = gfgetpower(gfchar); gffield = gftuple([-1 (gfprim.^gfpower(1:gfdegree-1))'],gfprim,m); else gffield = gftuple(m); end m = gffield.m; else gffield = gf; end % Get the primitive element of GF(2^M). prim = gffield.prim; % Get the decimal representation of V. v = double(v.x); % Remove leading zeros from V. v = v(find(v,1,'first'):end); % Get the degrees of U and V. degU = length(u) - 1; degV = length(v) - 1; % Initialize the quotient and remainder. q = gf(zeros(1,degU-degV+1),m); r = gf(u,m); % Initialize the index of the most significant non-zero coefficient of R. i = degU-degV+1; % Iterate until the degree of R is less than that of V. while i > 0 % Compute the degree of R. degR = length(r) - 1; % Get the degree of the next term to be subtracted from R. degT = degR - degV; % Compute the next term of the quotient if R is not zero. if degT >= 0 % Compute the factor to be multiplied with V. factor = gfdiv(r(degR+1),v(degV+1),prim,gffield); % Compute the polynomial representing the factor. polyFactor = gf([zeros(1,degT) double(factor.x)],m); % Update the quotient. q(i) = factor; % Update R. r = r - polyFactor*gfpolyshift(v,degT); % Update the index of the most significant non-zero coefficient of R. i = i - 1; else break; end end % Remove leading zeros from R. r = r(find(r,1,'first'):end); ```

相关推荐

最新推荐

recommend-type

matlab_函数嵌套

结合主、嵌套函数,分析代码,可以从以下三个方面展开分析: %可以从如下三个方面理解函数嵌套: %1、主函数funmin调用 a,b,c,x1,x2一个参数; %2、被调用函数poly3内含有x1,x2两个参数; %3、结合调用关系,funmin...
recommend-type

基于python实现matlab filter函数过程详解

主要介绍了基于python实现matlab filter函数过程详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
recommend-type

matlab函数大全-matlab函数大全.doc

matlab函数大全-matlab函数大全.doc 比较白痴的东西,不过对初学者也许有用,特分享一下。不要喷我哦!函数具体用法可以用help查一下。附件内容与下面一样的。 Aabs 绝对值、模、字符的ASCII码值 acos 反余弦 ...
recommend-type

C++如何调用matlab函数

主要介绍了C++如何调用matlab函数的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下
recommend-type

matlab灰度图像调整及imadjust函数的用法详解

主要介绍了matlab图像灰度调整及imadjust函数的用法详解,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

SPDK_NVMF_DISCOVERY_NQN是什么 有什么作用

SPDK_NVMF_DISCOVERY_NQN 是 SPDK (Storage Performance Development Kit) 中用于查询 NVMf (Non-Volatile Memory express over Fabrics) 存储设备名称的协议。NVMf 是一种基于网络的存储协议,可用于连接远程非易失性内存存储器。 SPDK_NVMF_DISCOVERY_NQN 的作用是让存储应用程序能够通过 SPDK 查询 NVMf 存储设备的名称,以便能够访问这些存储设备。通过查询 NVMf 存储设备名称,存储应用程序可以获取必要的信息,例如存储设备的IP地址、端口号、名称等,以便能
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。