How to compute in matlab the mean only on the numbers that are greater than 0.5 by old-school style, with for and if loops.
code
count=0;
sum=0.0;
n=input('enter n'); %read n
disp("enter n number");
for i = 1:n % loop through n numbers
x=input('');
% check for number greater than 0.5
if x > 0.5
sum+=x; %summing
count+=1; %incrementing count
end
end
% calculate average
avg=sum/count;
disp("average is")
disp(avg);
screenshot
sample output
please upvote if it helped
How to compute in matlab the mean only on the numbers that are greater than 0.5...
Matlab ==text only not images== ==correct solution only plz== a) Write a nested for loops to test if an input Matrix A is a sparse matrix or not. A sparse matrix is a matrix in which most of the elements are zero. By contrast, if most of the elements are nonzero, then the matrix is considered dense. The number of zero-valued elements divided by the total number of elements is called the sparsity of the matrix, so matrix A will...
*** write in matlab *** use for loops largestfactor_for Write a function that takes a positive integer greater than one and returns its largest factor (other than itseir). You must use a for loop to solve this problem. Do not use functions factor), primes(), and divisors() . Do not use while loops Do not use vectorized code. alargestfactor 105) 35 largestfactor_for Write a function that takes a positive integer greater than one and returns its largest factor (other than itseir)....
In the following, state whether: the probability is greater than 0.5, lower than 0.5, equal to 0.5, or if it is not possible to tell just by common sense, without computing the actual probabilities. (a) P(X < 612) when X ~N(725, 100) (b) P(X > 11.44) when X~N(15.05, 3.45) (c) P(252 < X 3 277) when XN(245,25)
Write a program to find out how many numbers are greater than 0 and how many are less than 0 out of 10 numbers read from the user. Test your program on the following: -1 -2 -3 -4 -5 -6 7 8 9 10
MATLAB Only MATLAB Only MATLAB Only Indicated in the script below, write a function, called arbpoly3, that accepts two inputs: i) a row vector, called c, containing the coefficients of the polynomial, starting with the coefficient for the lowest degree term, which is the constant term. ii) a row vector, called x, which is the set of real numbers where the polynomial is to be evaluated. The output, y, will be a vector containing the values of the polynomial, evaluated...
Question 4 (0.5 points) Consider the following hypotheses: Ho: mean = 5 H1: mean < 5 A test is performed with a sample of size 25. The sample mean was 4.68 and the population standard deviation is 1.2. Assume that the population is approximately normal. Use the TI-84 PLUS calculator to compute the P-value. Round your answer to four decimal places (for example: 0.0138). Write only a number as your answer. Your Answer: Answer Question 5 (0.5 points) Consider the...
How do I solve using Matlab? Below is a matrix of random numbers. Find the mean, median, and mode of the matrix. B=[0 1 2 3 4 50 689 23092 68 40 7] Sort Matrix Z so that the largest numbers of each row are in the first column and smallest numbers descend towards the last column. Must use sort function.
1)Compute the Mean, Median and standard deviation of the following numbers: 6,3,4,2,-1,1(6---pts) a) Sketch an informative sample histogram showing a distribution (of your choice) that is skewed to the left.(3pts) b) Will the mean be greater or less than the median?(1---pt)
Do it with three methods in Matlab. b > 0 (any value greater than 0) and also same for P which is greater than 0. Use maflah
Use MATLAB: Use a conditional while loop to find the first factorial that is greater than the input argument high. (high=5000) Please provide matlab code.