To be answered in the form of a Matlab code:
Write a code that finds the sum of all the positive elements in the input received by the computer as a row matrix (assume all the elements are integers, and there exists at least one positive integer among the input values):
Example:
? = [1, -4, 12, -51, -1]
? = ?????? = 13
function [result] = sum_all_positives(v)
result = 0;
for i=1:length(v)
if v(i) > 0
result = result+v(i);
end
end
end

To be answered in the form of a Matlab code: Write a code that finds the...
Create a script that receives any row matrix with positive integer elements as the input (suppose you have at least two elements in your matrix), and creates the output as a row matrix with only two elements, where the first element will be sum of all the oddly placed element of the input, and the second value will represent the sum of all the evenly placed elements of the input: Example: A = [11 , 4 , 42 , 31...
MATLAB
Write a code where the elements of a squared matrix size (order) n are equal to the sum of its row and column position (I + j)
8. Consider the following algorithm, which finds the sum of all of the integers in a list procedure sum(n: positive integer, a1, a2,..., an : integers) for i: 1 to n return S (a) Suppose the value for n is 4 and the elements of the list are 3, 5,-2,4. List assigned to s as the procedure is executed. (You can list the the values that are values assigned to all variables if you wish) b) When a list of...
Write a code such that for any given vector with integer components, it finds the elements which are the multiples of both 6 and 9. in matlab
4. I. Write a MATLAB code to find whether a given positive integer is a perfect number or not. A perfect number is a positive integer that is equal to the sum of its proper divisors. II. Write a MATLAB code to find the number of digits of a given positive integer. III. Consider the vector ? = −10, −7, −4, … , 14. Replace all negative entries with zeros.
Matlab: Write a function called minimax that takes M, a matrix input argument and returns mmr, a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. As a second output argument called mmm, it provides the difference between the maximum and minimum element in the entire matrix. See the code below for an example: >> A = randi(100,3,4) A = 66 94 75 18 4 68 40 71 85 76...
cope the code please
thanks
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate a matrix "A" as follow. A= 16 6 8 2 10 18 12 14 4 I. II. Divide the matrix A by 2 and store the result in a matrix B. Combine matrices A & B to obtain the following matrix C. Also...
*** Write a function called circular_primes that finds the number of circular prime numbers smaller than n, where n is a positive integer scalar input argument. For example, the number, 197, is a circular prime because all rotations of its digits: 197, 971, and 719, are themselves prime. For instance, there are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. It is important to emphasize that rotation means circular...
matlab
1. Write a MATLAB user-defined function that finds the largest element(s) of a matrix. Name the function [max_value, max_index] - LASTNAMES matrix max (x), where input argument x is a vector or matrix (not a scalar), and the outputs are the maximum value(s) and indexes of the maximum value(s) of the mput x. Do not use MATLAB functions max() or find(). Use loops and if branches to determine the maximum elements of matrix. Check for correct number and valid...
Using MATLAB code Assume you have a single row vector stored in a variable. You do not know how many elements are in the vector. Write your own code that sums all the elements in the vector. You are not allowed to use "sum" or any form of loops. (Hint: Use vector characteristics. It will be a single line code.)