problem in code in finding coefficients of filter throught PSO

f=linspace(1,100000);
w=2*pi*f;
fo=1e3;
wo=2*pi*fo;
s=(1i*w)./wo;
for alpha=0.1:0.3:0.9
a0=(alpha^2+3*alpha+2);
a1=(8-2*alpha^2);
a2=(alpha^2-3*alpha+2);
Approx=a0./(a1.*s.^(1+alpha)+a2.*s.^alpha +1);
end
k1=0.5012;
k2=0.6449;
k3=0.7079;
Cs=k1./(Approx.*(s+k2)+k3);
figure(1) title('Implementation of FLPA using different values for (1+alpha)')
hold on
semilogx(f,20*log10(abs(Cs)),'color','r');
hold off
legend('alpha=0.1')
xlabel('frequency,(Hz)')
ylabel('Magnitude(db)')
i have applied loop but it doesn't give plot according to alpha value and i want this code to run in PSO . can anybody help in this please and also the value of k1 k2 and k3?

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by