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