Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How to add the values of the attached plot in MATLAB to have the summation as a final result?
조회 수: 1(최근 30일)
표시 이전 댓글
Hello, I have a code and I have plotted the results like the attached figure, I want to add each Y value generated from the code put the whole summation in one dependent..Is there any way?

댓글 수: 5
Adam Danz
2019년 9월 10일
편집: Adam Danz
2019년 9월 10일
The sum() function doesn't appear in your code so I can't see what you tried.
The only thing needed to test my suggestion is the line that plots your data. I see you're plotting within a loop which is why my suggestion isn't working. Plotting within a loop is usually not a good idea. Instead of updating the plot on each iteration, gather all of the data within the loop and then create the plot after the loop. "t" and"I_total_hourly" should then be vectors. Then the answer to your problem is just sum(I_total_hourly).
Also, all of those instructions on how to run the code are hard to follow and defeats the purpose of automated analysis in the first place.
답변(1개)
Ahmed Saeed Mansour
2019년 9월 15일
댓글 수: 1
Adam Danz
2019년 9월 17일
편집: Adam Danz
2019년 9월 17일
The short answer is, I have no idea what you're asking.
I cannot run your code because of several missing values.
You ask "if we wanna calculate the nergy of that day will we use this formula: E_total_day= I_total_day*(t_sunrise-t_sunset) which represents the area under the curve? "
But I don't know what any of those variables represent or what you're trying to calculate. "I_total_day" isn't even a variable in your code.
Several lines of this code don't belong in a for-loop. For example, this line below will always produce the same output so why include it in the for-loop?
delta=23.45*(sind(360*(284+N)/365.25));
These lines below should never be in a loop.
hold on
xlabel('Time Of Day (Hours)')
ylabel('Total Insolation (W/m^2)')
I suggest taking some tutorials.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!