How to use a function with array output for each value in a different array?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I am trying to calculate how much of the sun's energy is collected by the earth every year in a particular location.
I have already calculated how much energy is collected for every daylight hour in one day. To do this, I calculated the zenith angle for the sun at every daylight hour:
phi = 43 % longitude
delta = 7 % solar declination
w = [80 , 60 , 50 , 30 , 20 , 5] % sun angles at every daylight hour
zenith = acosd((cosd(phi)*cosd(delta)*cosd(w))+(sind(phi)*sind(delta))); % zenith angles
This gives me 6 zenith angles for each angle input. So I have the zenith angles for a day.
I now want to do this for every day of the year.
Each day, the solar declination (delta) changes. I can calculate these values, delta ends up being an array with 365 values.
Because delta and w have different array sizes, I haven't been able to use this function for these two arrays at once and I do not know how to do them separately. Ideally, I would want a matrix with each day's zenith angles on each row of the matrix.
How do I do this?
댓글 수: 0
채택된 답변
Stephen23
2021년 10월 6일
"Ideally, I would want a matrix with each day's zenith angles on each row of the matrix."
That is easy, just make sure that DELTA and W are vectors with the appropriate orientations. Note also that I used TIMES (i.e. element-wise multiplication) and not MTIMES (i.e. matrix multiplication) like you used.
phi = 43; % longitude
delta = (0:0.1:20).'; % solar declination for lots of days
w = [80,60,50,30,20,5]; % sun angles at every daylight hour
zenith = acosd((cosd(phi).*cosd(delta).*cosd(w))+(sind(phi).*sind(delta)))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Solar Power에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!