how to find x if i only know y?
1 次查看(过去 30 天)
显示 更早的评论
close all
clear all
h=[1:24];%hours in day
m=[1:14400];%minutes in day
n_param=5;
n=[1:365];%days in year
az=0.0001; % degrees %a=0,001 , because a is near zero during sunrise and sunset.
ndec=355; %21 december is de 335e dag van het jaar
njul=202; %21 juli is de 202e dag van het jaar
p=52.3667; %altitude amsterdam
heigthblock=25; %heigth of the block in mETER
sino=zeros(1,365);
max_loops = 100;
for i_days=n
sino=-23.45*(pi/180)*cos(((2*pi)/365)*(10+n)); %the declination angle should be a function of day number,so o the declination angle is the inverse sinus of sino (the sinus of de declination angle
o=asind(sino); %this is the inclination angle
end
how do i calculate the n for o=0. in know that for o=0, sino=0,5*pi or 1,.5*pi
1 个评论
Walter Roberson
2019-12-15
https://www.mathworks.com/matlabcentral/answers/496717-my-code-doesnt-show-a-graph-even-if-i-use-the-plot-command has some code fixes for you
采纳的回答
Jesus Sanchez
2019-12-15
As you are working with degrees, I consider that you want to have natural numbers as a result, not something like 5.0358 degrees, with decimals. Therefore, I included "round" in the code. Then I just apply an "if" commando and store the days when o is 0:
close all
clear
clc
h=[1:24];%hours in day
m=[1:14400];%minutes in day
n_param=5;
n=[1:365];%days in year
az=0.0001; % degrees %a=0,001 , because a is near zero during sunrise and sunset.
ndec=355; %21 december is de 335e dag van het jaar
njul=202; %21 juli is de 202e dag van het jaar
p=52.3667; %altitude amsterdam
heigthblock=25; %heigth of the block in mETER
sino=zeros(1,365);
max_loops = 100;
result = []; % To store the days when o is 0
for i_days=1:length(n)
sino=-23.45*(pi/180)*cos(((2*pi)/365)*(10+n(i_days))); %the declination angle should be a function of day number,so o the declination angle is the inverse sinus of sino (the sinus of de declination angle
o=asind(sino); %this is the inclination angle
o = round(o); % This round to a natural number. Change precission or comment if you dont want it.
if o == 0
result(end+1) = n(i_days); % Store day
end
end
fprintf('Days where o is equal to 0 deg:\n ');
fprintf('%g ', result);
2 个评论
Jesus Sanchez
2019-12-15
You just need to change the line:
if o == 0
Instead of 0, you can write any number. Also, take care as I rounded the results of o, you should either use natural numbers in the if condition or comment o = round(o). If you want several values to be checked at the same time, that is also possible using vectors, for loops or even a built-in function called find.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Earth and Planetary Science 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!