Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1- Create a function named “remove_vowels” which takes in a sentence as input ar

ID: 3836504 • Letter: 1

Question

1- Create a function named “remove_vowels” which takes in a sentence as input argument and returns the following parameters: The same sentence after removal of vowels The indices of the vowels present in the input sentence Length of the new sentence formed after the removal of vowels.  
Create a Script file named “run_remove_vowels” which lets the user enter the sentence. Later call the function “remove_vowels”, display the newly framed sentence after the removal of vowels

2-Create a new function remove_vowels_v2() that takes in a second input argument which lets the user enter the index of the word. For instance for the sentence below, the word “course” has a word index of 3.
“This MATLAB course is just amazing”
Your target from now would be to remove the vowels present only in that word (“course” if the word index is 3) and your function should return the sentence with only that word altered (vowels removed). Do help on isspace(). This function returns a logical array (0 or 1) of same size as the sentence. Logical value is assigned to every character present in the sentence. 0 if it’s a letter, 1 if the words are separated by a space. You may assume that the user would enter a sentence with words separated by a single space (No punctuations).

using **matlab**

Explanation / Answer

1. run_remove_vovels.m

function [newsent, indexarr] = run_remove_vovels(sent)
indexarr = [];
newsent = [];
for i = 1:size(sent,2)
if(sent(i) =='a'|sent(i)=='e'|sent(i)=='i' | sent(i) == 'o' | sent(i) == 'u')
indexarr = [indexarr, i];
else
newsent = [newsent, sent(i)];
end
end
end

2. remove_vovels.m

function [newsent] = remove_vovels(sent,index)
newsent = [];
arr = strsplit(sent, ' ');
w = arr(index);
[w,b] = run_remove_vovels(char(w));
arr(index) = w;
for i = 1:size(arr,2)
newsent = [newsent,arr(i),' '];
end
end

driver.m

s = remove_vovels('my name is akash', 2)

[a,b] = run_remove_vovels('my name is akash')