Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

my figure doesnt isnt right

1 visualización (últimos 30 días)
Iris Kiebert
Iris Kiebert el 15 de Dic. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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 comentarios
Iris Kiebert
Iris Kiebert el 16 de Dic. de 2019
I added a n_loops=0,but the figure is still funny. What to do?
Rik
Rik el 16 de Dic. de 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).

Respuestas (0)

La pregunta está cerrada.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by