Home > wafo > trgauss > private > rfadd.m

rfadd

PURPOSE ^

Addition of two rational functions

SYNOPSIS ^

R=rfadd(R1,R2)

DESCRIPTION ^

  RFADD Addition of two rational functions 
  
    CALL:   R = rfadd(R1,R2); 
  
  Addition of two rational functions. A rational function  
  
  (a(1)+a(2)*x+...a(d1)*x^(d1-1)) / (b(1)+b(2)*x+...b(d2)*x^(d2-1)) 
  
  should be stored as a 2 x d matrix, where d=max(d1,d2): 
  [a zeros(1,d-d1);b zeros(1,d-d2)]

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

01 function R=rfadd(R1,R2) 
02 % RFADD Addition of two rational functions 
03 % 
04 %   CALL:   R = rfadd(R1,R2); 
05 % 
06 % Addition of two rational functions. A rational function  
07 % 
08 % (a(1)+a(2)*x+...a(d1)*x^(d1-1)) / (b(1)+b(2)*x+...b(d2)*x^(d2-1)) 
09 % 
10 % should be stored as a 2 x d matrix, where d=max(d1,d2): 
11 % [a zeros(1,d-d1);b zeros(1,d-d2)] 
12  
13 RR=[conv(R1(1,:),R2(2,:))+conv(R2(1,:),R1(2,:));conv(R1(2,:),R2(2,:))]; 
14 [waste,newlength]=min(find(sum(abs(RR),1)~=0)); 
15 RR(:,1:newlength-1)=[]; 
16 R=RR;

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003