Filter löschen
Filter löschen

Problem with radians and degrees

2 Ansichten (letzte 30 Tage)
Luccas S.
Luccas S. am 29 Apr. 2021
Kommentiert: Luccas S. am 29 Apr. 2021
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

Akzeptierte Antwort

the cyclist
the cyclist am 29 Apr. 2021
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 Kommentar
Luccas S.
Luccas S. am 29 Apr. 2021
Thanks, I was thinking it was a problem with some MATLAB conversion.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by