Want to run same script for 100 times without changing any variable and then taking the average of the output.

Hi all, I want to run the same script multiple times and then want to take the average of the results and plot them. Is there any way I can do that. I am new to MATLAB so if someone can suggest a simple would great. Thanks in advance.

 Respuesta aceptada

for k=1:100
yourScript;
Output(k)=y;%whatever variable that is the output
end
m=mean(Output);
plot(Output);

1 comentario

Now with this approach i am able to run the same script multiple times but when I am trying to take mean of the output it is showing error " Invalid data type. First argument must be numeric or logical".

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 17 de Ag. de 2022

Comentada:

el 18 de Ag. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by