Azzera filtri
Azzera filtri

Problem with radians and degrees

3 visualizzazioni (ultimi 30 giorni)
Luccas S.
Luccas S. il 29 Apr 2021
Commentato: Luccas S. il 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

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by