Problem with radians and degrees
4 次查看(过去 30 天)
显示 更早的评论
I am implementing this code. And the result does not match at all. The result must be in radians and the result must be the following:
sigma (1) = -0.247
omega (1) = 0.966
sigma (2) = -0.494
omega (2) = 0 ~ very small number almost zero
sigma (3) = -0.247
omega (3) = -0.966
I found this on the calculator (in radians). But the program doesn’t match at all
% Chebshevy Poles
clc
clear
n = 3; % filter order
ripple = 1; % dB
epsilon = sqrt(10^(0.1*ripple)-1)
a = (1/n)*asinh(1/epsilon)
for k = 1:1:n
sigma(k) = -sinh(a)*sin(((2*k-1)/2*n)*pi);
omega(k) = cosh(a)*cos(((2*k-1)/2*n)*pi);
end
The value of this a is 0.476
0 个评论
采纳的回答
the cyclist
2021-4-29
You need parentheses around 2*n. Otherwise, MATLAB will divide by 2, then multiply by n.
% Chebshevy Poles
clc
clear
n = 3; % filter order
ripple = 1; % dB
epsilon = sqrt(10^(0.1*ripple)-1);
a = (1/n)*asinh(1/epsilon);
for k = 1:1:n
sigmak(k) = -sinh(a)*sin(((2*k-1)/(2*n))*pi);
omegak(k) = cosh(a)*cos(((2*k-1)/(2*n))*pi);
end
disp(sigmak)
disp(omegak)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!