blob: 019c08aa9a946bf62bfe9e04cadb964d37db91bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// polyscale Scaling roots of a polynomial
// scales the roots of a polynomial in the z plane
//Syntax:
//b = polyscale(a,alpha)
// where
//a is the vector containing the polynomial coefficients
// alpha is the scaling vector
//
//EXAMPLES:
//to scale the seventh roots of unity ,x^7=1,
////we represent
//p=[1 0 0 0 0 0 0 -1] and changing the scaling factor,
//b=polyscale(p,0.85)
//EXPECTED OUTPUT:b=1. 0. 0. 0. 0. 0. 0. - 0.3205771
//p=[1 0 0 0 0 0 0 -1] and changing the scaling factor,
//b=polyscale(p,0.95)
//EXPECTED OUTPUT:b=1. 0. 0. 0. 0. 0. 0. - 0.6983373
//
//p=[1 0 0 0 0 0 0 -1] and changing the scaling factor,
//b=polyscale(p,1)
//EXPECTED OUTPUT:b=1. 0. 0. 0. 0. 0. -1
// Author
//Debdeep Dey
function b = polyscale(a,alpha)
//errcheck1
if(min(size(a))>1) then
error('Input polynomial must be an array')
end
if type(a)==10 then
error("Input cannot be of type char");
end
b = a .* (alpha .^ (0:length(a)-1));
endfunction
|