how can i plot in the while loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
fatemeh jan
el 8 de Abr. de 2019
Comentada: fatemeh jan
el 8 de Abr. de 2019
hey gays ive written a code @ it dosent have an error but it doesnt plot what i want what can i do with this ?
clear
t=16;
d=23;
M=5;
N1=floor(((275*(1/M))-30+d)-2);
s1=23.45*sind((360/365)*(284+(N1+2)));
l=35.44;
B=(N1-81)*360/364;
h=0.25*(t-12)*60;
z(1)=0;
while z<pi
z=0.1+z;
x=sin(l)*sin(s1)*cos(B)-cos(l)*sin(s1)*sin(B)*cos(z)+cos(l)*cos(s1)*cos(h)*cos(B)+sin(l)*cos(s1)*cos(h)*sin(B)*cos(z)+cos(s1)*sin(h)*sin(B)*sin(z)
theta=acos(x)
plot(theta,z)
end
6 comentarios
Respuesta aceptada
Alex Mcaulley
el 8 de Abr. de 2019
Then, you simply need this:
t=16;
d=23;
M=5;
N1=floor(((275*(1/M))-30+d)-2);
s1=23.45*sind((360/365)*(284+(N1+2)));
l=35.44;
B=(N1-81)*360/364;
h=0.25*(t-12)*60;
z = 0:0.1:pi;
theta = acos(sin(l)*sin(s1)*cos(B)-cos(l)*sin(s1)*sin(B)*cos(z)+cos(l)*cos(s1)*cos(h)*cos(B)+sin(l)*cos(s1)*cos(h)*sin(B)*cos(z)+cos(s1)*sin(h)*sin(B)*sin(z));
plot(theta,z)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!