(Matlab) What am I missing in order to compile the funciton function hist = annu
ID: 3594557 • Letter: #
Question
(Matlab) What am I missing in order to compile the funciton
function hist = annualEnergy(Data, thresh);
n=[0.256 0.576 0.384 0.192 0.832 0.576 0.256 0.128 0.192];
for i = 1:n
A= i.*7.77
if A >2
plot(A)
end
end
Given:
Create a function and use forloops and if statements to determine how many times during the year that hourly energy usage stored in an array is greater than 2 kWh per hour. Do the calculation for each individual hour and plot the results with the time on the x-axis and the number of times on the y-axis.
Thank you in advance.
0:00 0.256 0.576 0.384 0.192 0.832 0.576 0.256 0.128 0.192 1Explanation / Answer
function hist = annualEnergy(Data, thresh);
n=[0.256 0.576 0.384 0.192 0.832 0.576 0.256 0.128 0.192];
for i = 1:n
A = i.*7.77
if A >2
plot(A)
end
end
end
(Matlab) What am I missing in order to compile the funciton
You were missing end at the end for compilation.
I have answered this only as this was the questio asked. Please don't post comment asking me about your logic as am not checking that right now as question didn't ask about it.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.