Load the data into a vector and compute this average using a while loop + Using tic() and toc()
Mostrar comentarios más antiguos
Hello, my name is Paul. I'm a beginner user in MATLAB. One of my courses assign me a problem I should use a while loop (with a text file), and tic() and toc(). Below is what I want to create.
Problem Statement
You are an electrical engineer working with renewable energy. The file ClassSDPprep_watss.txt has the maximum power in Watts required in a house for each day for the month of March. You want to compute the average power requirement for the month of March. You will need to load the data into a vector and compute this average using a while loop. Using tic() and toc() determine how long the program took to run and print the results to the screen.
I attach the text file that is needed to be calculated using a while loop as well as my attempt typing codes.
Appreciate your time and understanding.
Respuestas (1)
Walter Roberson
el 2 de Nov. de 2017
Undefined function 'Length' for input arguments of type 'double'.
Error in Problem_3_SDP_code (line 14)
while Period < Length(Power)
MATLAB is case sensitive. Length() is considered to be different than length()
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!