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

采纳的回答

the cyclist
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)
-0.2471 -0.4942 -0.2471
disp(omegak)
0.9660 0.0000 -0.9660
  1 个评论
Luccas S.
Luccas S. 2021-4-29
Thanks, I was thinking it was a problem with some MATLAB conversion.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by