Please provide Matlab code for the following You get the task to design a filter
ID: 3600929 • Letter: P
Question
Please provide Matlab code for the following
You get the task to design a filter that meets a couple of specifications given below. Since your boss wants to save some money, he/she tells you to provide him/her with a filter that is as economical as possible. What you have is a device that samples at frequency of 20 kHz - and you are supposed to use it! The statement of your boss is: "How hard can it be to cut off a couple of frequencies? Just cut them off and get going!". You remember from your DSP course that there was a big fuzz about how to design a filter but maybe your boss is right? Why not just cut off the higher frequencies? So you get started: Design a filter that meets the specifications below. Use different approaches (Butterworth, Chebychev I/II, Elliptic, simple "cutting" in the frequency domain) and decide which filter you would present to your boss. Collect and discuss arguments for your decision: .Gain of no less than -2 dB in the frequency range 0, 1000 Hz .Gain of not more than -40 dB in the frequency range [2000, 10.000 Hz Ripples might be accepted if they don't exceed 1 dB useful commands: buttord, cheblord, cheb2ord, ellipord, butter, cheby1, cheby2, ellip, zplane, freqz, fft, filter For each filter, provide (if applicable) the order n, the frequency response, the phase and the impulse response. Compare these across the filters you designed.Explanation / Answer
findmax (40 points)
#
# $a0: the starting address of an asciiz string
# $a1: the starting address of an allocated memory space to which the maximum length word is to
# be copied, ending with a 0 to make it an asciiz string
#
# Note: Must call the getword function to examine one word at a time
# -----------------------------------------------
# -----------------------------------------------
# getword (40 points)
#
# $a0: the starting address of an asciiz string, say, A, at this address, the content must be the
# ascii code of an English letter, either upper case of lower case
# $a1: the starting address of an allocated memory space, to which the first word in string A can
# be copied, ending with a 0 to make it an asciiz string
# $v0: the length of the word
#
# Note: Must call the isletter function
# -----------------------------------------------
# -----------------------------------------------
# isletter (20 points)
#
# $a0: a value
$ $v0: returns 1 if the value in $a0 is the ascii code of an English letter, 0 otherwise
# -----------------------------------------------
"
returnres : .space 100
.text
.globl main
main:
la $a0, dialog
la $a1, returnres
jal findmax
li $v0,4 # now print the found longest word
la $a0,returnres
syscall
done:li $v0, 10 # Exit
syscall
findmax:
jr $ra
getword:
jr $ra
isletter:
jr $ra
# -----------------------------------------------
# strcpy
#
# Note: copies the string starting at $a1 to an allocated memory space starting at $a0, the same
# as the code we wrote in the class, will be useful
# -----------------------------------------------
strcpy:
lb $t0, 0($a1)
sb $t0, 0($a0)
addi $a0, $a0, 1
addi $a1, $a1, 1
bne $t0, $0, strcpy
jr $ra
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.