MATLAB Answers

How to work the Mean function

3 views (last 30 days)
Hi Everone,
I have a question in relation to the .
I fed into the MAtlab 2019a a simple instruction, i.e., mean of two variables (example underneath) and it would not solve it anyway
imean1=mean(abs(i_min_1(1,1)),i_max_1(1,1));
If I use it in a translated mathematical formula like underneath:
imean1=(abs(i_min_1(1,1))+i_max_1(1,1))/2;
then it works flwalwssly and very fine proceed with calculation.
Please let me know what could go wrong with it.
Many thanks in advance.
Andras

  0 Comments

Sign in to comment.

Accepted Answer

Adam
Adam on 8 Aug 2019
doc mean
shows you the syntax of the mean function. It expects an array, not multiple arguments. Generally you take the mean of more than 2 inputs so having them as individual arguments would not be sensible.
mean( [ abs(i_min_1(1,1)),i_max_1(1,1) ] );
should work.

  1 Comment

Stephen Cobeldick
Stephen Cobeldick on 8 Aug 2019
Andras Gergely's incorrectly accepted "Answer" moved here:
Thanks Adam.
I followed a different synthax to solve my issue but this is one also works.
By now it is clear.
Many thanks for that.

Sign in to comment.

More Answers (1)

Andras Gergely
Andras Gergely on 8 Aug 2019
Thanks MAdhan RAvi!
Best wishes. :)

  0 Comments

Sign in to comment.

Tags

Products


Release

R2019a