Home > wafo > trgauss > private > rfadd.m

## DESCRIPTION

```  RFADD Addition of two rational functions

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:
 conv Convolution and polynomial multiplication.
This function is called by:
 mindist3 Finds point of minimal distance to the origin on the surface b'*x+g'*x.^2=u.

## SOURCE CODE

```01 function R=rfadd(R1,R2)
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