what will be the program in matlab to find the average of various numbers?
Show older comments
average means the sum of a list of numbers divided by the size of the list, in other words the arithmetic mean.
Accepted Answer
More Answers (4)
per isakson
on 29 May 2013
Try
doc mean
2 Comments
Dwayne
on 29 May 2013
Matt Kindig
on 29 May 2013
There really isn't any more programming to give you. Andrew's answer is literally all you need.
Olayemi Akinsanya
on 12 Sep 2017
Edited: Walter Roberson
on 17 Mar 2024
function resultv = mymean(P)
mysum=0;
for i=length(P)
mysum= mysum +(i);
end
resultv = mysum/length(P);
end
Salam Adil
on 19 Jun 2021
0 votes
write aprogram by matlab to calculate the average of 9 subject of student and then write the description of his average
Rajesh
on 17 Mar 2024
0 votes
What is a correct matlab statement that will find the average of the prime numbers in a given 1D matrix A.
1 Comment
Steven Lord
on 17 Mar 2024
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!