The following MATLAB command has been used to perform offline filtering >>y=filt
ID: 1813589 • Letter: T
Question
The following MATLAB command has been used to perform offline filtering
>>y=filter([0.8 -0.8],[1 -0.3],x);
Where x and y are the input and output vectors, respectively. What is the transfer function of the filter?
A. H(z)=0.8-0.8_z^-1/1-0.3_z^-1 B. H(z)=0.8-0.8_z^-1/1+0.3_z^-1 C. H(z)= 1+0.3_z^-1/0.8-0.8_z^-1
Convert an anamlog filter with the transfer function
H(s) = 2500/s+2500
convert it to the digital transfer function and difference equation using the BLT if the DSP system has a sampling period of T=0.001 sec.
Explanation / Answer
Below is the code and below the code is an example for n = 5.
function [prices_a, prices_b, prices_c, prices_d] = elseifWork
n = 5;
%% a - rand 1x100 matrix
prices_a = rand(1, n);
%% b - prices between [0, 10] rounded to 2 decimals
prices_b = round(prices_a * 1000)/100;
%% c - round up
prices_c = zeros(1, n);
for i = 1:n
if prices_b(i) < 1
prices_c(i) = 1;
else
prices_c(i) = ceil(prices_b(i));
end
end
% more efficient to do:
% prices_c = ceil(prices_b);
%%d - adjust prices to increments of $10
prices_d = zeros(1, n);
for i = 1:n
if prices_c(i) < 5
prices_d(i) = 10;
else
prices_d(i) = ceil(prices_c(i)*2/10)*10;
end
end
% more efficient to do:
% prices_d = ceil(prices_c*2/10)*10;
Example:
>> [a, b, c, d] = elseifWork;
>> a
a =
0.9879, 0.1704, 0.2578, 0.3968, 0.0740
>> b
b =
9.8800, 1.7000, 2.5800, 3.9700, 0.7400
>> c
c =
10, 2, 3, 4, 1
>> d
d =
20, 10, 10, 10, 10