필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

my figure doesnt isnt right

조회 수: 1 (최근 30일)
Iris Kiebert
Iris Kiebert 2019년 12월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
close all
clear all
%parameters
h=[1:24]; %hours in day in hours
m=[1:14400]; %minutes in day in minutes
n=[1:365]; %days in year
az=0.0001; % elivation angle at sunrise and sunset in degrees. i choosea=0,001 , because a is near zero during sunrise and sunset.
ndec=355; %daynumber of 21st december
njul=202; %daynmuber of 21st juli
p=52.3667; %altitude amsterdam in degrees
heigthblock=25; %heigth of the block in meter
for N=n
[n,h]=meshgrid(n,h);
wh=((h+12)*pi)/12; %OPDRAcht 4
sinoaz=-23.45*(pi/180).*cos(((2*pi)/365).*(10+n));
oaz=asind(sinoaz);
sinashadow=cosd(oaz).*cos(wh).*cosd(p)+sinoaz.*sind(p);
ashadow=asind(sinashadow);
%sinAshadow=(sind(wh).*cos(oaz))/sinashadow;
%Ashadow=asind(sinAshadow);
%Tan(a)=overstaande/aanliggende=height block/lenth shadow
%lenth shadow=heigth block/Tan(a)
lenthofshadow=heigthblock./(tand(ashadow));
surf(n,h,lenthofshadow)
while 15<ashadow||ashadow<90
n_loop=n_loop+1;
if (n_loop >= max_loops)
disp('exceeded max number of loops')
break
end
end
end
the x=daynumber, the y=hour of day and the z of my meshgrid is supposed to be the height of the shaduq influnced by x and y. but it doesnt look like a realistic figure. please help me out
  댓글 수: 3
Iris Kiebert
Iris Kiebert 2019년 12월 16일
I added a n_loops=0,but the figure is still funny. What to do?
Rik
Rik 2019년 12월 16일
Use the debugging tools. Put a breakpoint on the first line and step through your code line by line. See when the variables are different from what you expect.
And remove clear all. There is no reason to use it. If you insist on clearing the variables, only clear the variables. Since you do create a figure without explicitly clearing it, it makes sense to use close all, although I would advocate for replacing it with figure(1),clf(1).

답변 (0개)

이 질문은 마감되었습니다.

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by