Matlab polynomial operation and symbolic operation

Source: Internet
Author: User
Tags domain transfer

The use of polynomial operations and symbolic expressions is very convenient, the following summarizes a number of commonly used functions, and attached to their own writing to transform the S-domain into the z-domain function

polynomial Operations

1.r=roots (p) polynomial root-finding

2.p3=conv (P1,P2) polynomial multiplication

3.p1=polyder (p) polynomial derivation

3.polyval (p,x) Polynomial surrogate evaluation

4.polyfit (x,y,n) polynomial-fitting

5. [R,p,k] =residue (b,a) Fractional expansion

Note: The functions of polynomial operations are represented by vectors, and note the difference between them and the symbolic expressions, which can be converted to each other poly2sym (), Sym2poly ()

Symbolic Operations

1.syms x, y, Z; Defining Symbolic variables

2.sym=poly2sym (P, ' s '); convert a polynomial vector to a symbolic expression

3.p=sym2poly (sym); convert symbolic expressions to polynomial vectors

4.[n,d]=numden (sym); Separating the symbolic expression from the numerator denominator

5.subs (Sym, ' x ', value) algebraic evaluation of symbolic expressions

6. Simplify (SYM) simplification

7.pretty (sym) Beautify output symbol expression

8.expand (SYM) expand

9.collect (sym) Merge

10.solve (SYM) solves the solution of sym=0.


function [numz,denz]=s2z (NUMS,DENS,TS)
%[NUMZ,DENZ]=S2Z (Nums,dens,ts)
% function: Transform s-domain transfer function to Z-domain
Input
%nums,dens continuous system with s as variable molecule, denominator polynomial
Output
%numz,denz discrete systems with Z as variable molecules, denominator polynomial
Syms t n s z;
Gs_num=poly2sym (Nums);
Gs_den=poly2sym (dens);
Gs=gs_num/gs_den;
Ft=ilaplace (Gs); % of continuous transfer Laplace inverse transformation
Gnt=subs (Ft,t,n*ts); % discretization
Gz=ztrans (GNT); %z Transform
[A,b]=numden (Gz); The%numden function separates the numerator of the symbolic expression from the denominator
Numz=sym2poly (a);
Denz=sym2poly (b);
End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.