Program :
clc;
clear all;
n = input('Enter the no. of values:');
colr = ['g','b','r','k'];
for i = 1:n
r = input('Enter the value for r:');
d0 = 1+r*r-2*r;
w1 = 0:0.001:1;
d1 = 1+(r*r)-(2*r.*cos(w1));
ps = d0./d1;
hold on;
semilogy(w1,ps,colr(i));
end
xlabel('Frequency(Units of pi)');
ylabel('Power Spectrum');
title('Response of Low Pass Filter');
legend('r=.5','r=.75','r=.9');
Output:
Enter the no. of values: 3
Enter the value for r: 0.5
Enter the value for r: 0.75
Enter the value for r: 0.9
Output Graph:
clc;
clear all;
n = input('Enter the no. of values:');
colr = ['g','b','r','k'];
for i = 1:n
r = input('Enter the value for r:');
d0 = 1+r*r-2*r;
w1 = 0:0.001:1;
d1 = 1+(r*r)-(2*r.*cos(w1));
ps = d0./d1;
hold on;
semilogy(w1,ps,colr(i));
end
xlabel('Frequency(Units of pi)');
ylabel('Power Spectrum');
title('Response of Low Pass Filter');
legend('r=.5','r=.75','r=.9');
Output:
Enter the no. of values: 3
Enter the value for r: 0.5
Enter the value for r: 0.75
Enter the value for r: 0.9
Output Graph:
No comments:
Post a Comment