Write a MATLAB function for each exercises. Grade: by effort 1) is_palindrome Input: str -- a string Output: ret -- 1 if str is a palindrome, 0 otherwise Display: YES / NO Example: r =...

1 answer below »

Write a MATLAB function for each exercises.
Grade: by effort


1) is_palindrome
Input: str -- a string
Output: ret -- 1 if str is a palindrome, 0 otherwise
Display: YES / NO
Example: r = is_palindrome('aabbcc') --> 0
Hint: fliplr()


2) is_subset
test if A is a subset of B
Input: A, B -- array
Output: ret -- 1 if A is a subset of B, 0 otherwise
Example: r = is_subset([2 3], [3,2,1]) --> 1
Hint: ismember()


3) remove
remove every element of A from B, ALSO, DO NOT CHANGE B after function call!
Input: A, B
Output: ret
Example: r = remove([1,1], [1,2,1,2]) --> [2 2]
Hint: find()


4) all_in
Input: A, B -- arrays
Output: ret -- 1 if all element in A is in B, 0 otherwise
Example: r = all_in([1 1 2], [1 2 3]) --> 0
Hint: remove()



Answered Same DayJan 31, 2022

Answer To: Write a MATLAB function for each exercises. Grade: by effort 1) is_palindrome Input: str -- a string...

Nitin answered on Feb 01 2022
122 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here