Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

my figure doesnt isnt right

1 view (last 30 days)
Iris Kiebert
Iris Kiebert on 15 Dec 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
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 Comments
Iris Kiebert
Iris Kiebert on 16 Dec 2019
I added a n_loops=0,but the figure is still funny. What to do?
Rik
Rik on 16 Dec 2019
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).

Answers (0)

This question is closed.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!