Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

my figure doesnt isnt right

1 visualizzazione (ultimi 30 giorni)
Iris Kiebert
Iris Kiebert il 15 Dic 2019
Chiuso: MATLAB Answer Bot il 20 Ago 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 Commenti
Iris Kiebert
Iris Kiebert il 16 Dic 2019
I added a n_loops=0,but the figure is still funny. What to do?
Rik
Rik il 16 Dic 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).

Risposte (0)

Questa domanda è chiusa.

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by