The MATLAB routine analog _ filter1.m is a simulated analogfilter. (Calling structure: output = analog _ filter1(input);).Repeat the strategy used in Problem 1.2, but generate the inputsine waves in MATLAB and plot the output. Make Ts = 0.001 s and thenumber of points N = 1000. To generate sine waves, defne the timevector t = (0:999)*Ts as in Example 1.3. Use this vector togenerate the input sine waves at various frequencies: input =sin(2*pi*f*t);. Use frequencies of 2, 10, 15, 20, 30, 40, 50, 60,80, 90, 100, 150, 200, 300, and 400 Hz.
Find the amplitude of the output of analog _ filter1.m usingMATLAB’s max operator and plot the resulting values in dB versuslog frequency. This gives an approximation of the flter’s frequencycharacteristics or spectrum. Use this spectrum with the gridfunction enabled to determine the type, bandwidth, and attenuationslope of the flter. [Hint: Put the desired input frequencies in anarray and use a for-loop to generate the input sine waves. Storethe maximum values of the flter’soutput in an array for plotting.Plot the 20 log of the output values against the frequency arrayusing the semilogx routine.
I'd like to know the code from the beginning until end for myself-study because my instructor didnt teach me this even once.Thank you so much.
analog_filter1.m -> https://pastebin.com/htg8Yhhg (just openthe link and copy-paste it into matlab)