MATLAB Code:
(15)
function retval = changeVowels (input1)
% Function that replaces all vowels with x's
retval = lower(input1);
% Iterating over input string
for i=1:length(input1)
% Checking for vowels
if (retval(i) == 'a' || retval(i) == 'e' || retval(i) == 'i' ||
retval(i) == 'o' || retval(i) == 'u')
retval(i) = 'x';
end % If ebd
end % For end
end % function end
Sample Run:

___________________________________________________________________________________________________
(16)
function retval = swapArray (input1)
% Function that swaps the array elements
% Copying array
retval = input1;
% Last index
j = length(input1);
% Iterating over half of the array
for i=1:length(retval)/2
% Swapping elements
temp = retval(i);
retval(i) = retval(j);
retval(j) = temp;
j = j-1;
end % For end
end % function end
Sample Run:
![Command Window swapArray ([10 20 30 40 50 60 70 80]) ans - 80 70 60 50 40 30 20 10](http://img.homeworklib.com/questions/54582130-c17c-11eb-acb2-a7d1a860fd9d.png?x-oss-process=image/resize,w_560)
Matlab. Please add comments. Thank you in advance. 15. Write a code that can read in...
Java Code please read comments and add the code to required lines....LINE 1 to LINE 5 ********************************************************************** * Program Summary: This program demonstrates these basic Java concepts: * - Creating an array based on user input * - Accessing and displaying elements of the array * * The program should declare an array to hold 10 integers. * The program should then ask the user for an integer. * The program should populate the array by assigning the user-input integer...
using matlab
In Class Exercises 8-Arrays For the following exercises, assume an array is already populated, your job is to write a program that traverses the array. DO NOT HARD CODE the last index. In other words, you code for 1-4&6 should be able to handle the following 2 arrays: amp2 10 array1 [52, 63, 99, 71, 3.1] array2 - [99:-3: 45); For 5: wordArray1 wordArray2 ('number, 'arrays', 'indices', 'hello', finish' [number, 'different, 'finish? 1. Determine the sum of all...
JAVA / please add comments Write code for a method named loadDatagrams() that returns an array of type Datagram. The method will read from the filepath C:/folder/grams.dgf and the file contains an array of type Datagram ( you may assume that the class definition is visible to the method) Remember to include appropriate exception handling
Can someone solve number 5 using Matlab?
In Class Exercises 8-Arrays For the following exercises, assume an array is already populated, your job is to write a program that traverses the array. DO NOT HARD CODE the last index. In other words, you code for 1-4&6 should be able to handle the following 2 arrays: amp2 10 array1 [52, 63, 99, 71, 3.1] array2 - [99:-3: 45); For 5: wordArray1 wordArray2 ('number, 'arrays', 'indices', 'hello', finish' [number, 'different, 'finish? 1....
Write code in static void main method class, which creates a boolean array called flags, size 10, and using a for loop sets each element to alternating values (true at index zero, false at index one Write code in a static void main method class, which creates a float array called sales, size 5, uses an initializer list to instantiate its elements with positive values having two decimal places (example 7.25), and using a for loop reads those values of...
Write the code in PYTHON and please provide the
full code, thank you!
Write a program that plots two functions: f(x) = x2 and g(x) = ax. Write it in such a way that the intersection points are marked with an X, for arbitrary a. • You may use your favorite ready-made function to find the intersection points, if not: • One possible way to tackle this problem is to put both function values in arrays and check using a...
Please write a MATLAB code for this
4. Create a function called changearray(A) that would add 20 to all non-positive elements of an array A and take the natural logarithm of all positive elements of A? >> A = randn (4,5) *5 A = 1.5176 -3.0016 2.4498 3.6968 8.5594 -0.9706 -10.6918 -4.1979 6.7730 -5.3608 4.8048 0.6202 7.1835 -9.8045 -0.9885 -6.0392 14.5400 4.1261 6.8949 -5.2909 >> changearray (A) 0.4171 2.1470 16.9984 19.0294 0.8960 9.3082 1.307515.8021 1.91291.9718 14.6392 10.1955 1.5696 19.0115 -0.4776...
#PLEASE WRITE THE CODE IN JAVA! THANK YOU IN ADVANCE! Write a program that manages a list of up to 10 players and their high scores in the computer's memory. Use two arrays to manage the list. One array should store the players' names, and the other array should store the players' high scores. Use the index of the arrays to correlate the names with the scores. Your program should support the following features: a. Add a new player and...
MATLAB: Write a code using loop for which implements the following algorithm for finding the maximal element in a vector (without using the ready Matlab function max): 1) Assume the first element of the vector to be the maximal one and assign its value to MyMax. 2) Take the second number and compare with the current maximum. If the second number is bigger, assign it as the new maximum, otherwise keep the old max as reference. 3) Take the third...
PLEASE ADD COMMENTS EXPLAINING EACH LINE OF CODE
THANK YOU
QUES TION 7 10 points Save Answer The following program tries to print all the elements of the numbers list. However, it does not work! Please describe the issue and fix the error. numbers-3,5,7,9 for i in (len (numbers)): print (numbers [i]) TTT Arial ▼T. :- . -. , 3112pt) Path: