How to plot 3d mesh surface?
Mostra commenti meno recenti
I wanted to know how to obtain a 3D mesh surface plot of Beta1,Beta2,Beta3,Beta4,Beta5 for the following code with k=1:24,L=0:80 degree for dn=100.initially it was only one Beta,k and L but it was hard for me to code as iam a beginner so i separated for each L=0:20:80 i made it like Beta1,Beta2,Beta3,Beta4,Beta5,now i am current stuck with how to plot all this Betas as Beta,k and L variable into a 3d mesh surface plot.Can anyone give a hint on how to resolve this ?
%Part A
% a)plot graph solar declination versus the day number
dn=1:1:365;
x=(360/365*(dn+284));
sdelta=23.45*(sind(x));
figure(1)
plot(dn,sdelta)
grid on
title('solar declination vs number of days')
xlabel('number of days')
ylabel('solar declination')
% b)i)
[a,b]=max(sdelta);
[c,d]=max(a);
disp('max value and number of days')
disp([c,d]);
%b)ii)
[e,f]=min(sdelta);
[g,h]=min(e);
disp('min value and number of days')
disp([g,h]);
%b)iii)
sdelta = rand(1,365);
targetangle = [-0.3 0.3];
Numberdays = sdelta >= targetangle(1) ...
& sdelta <= targetangle(2);
numberofdays = nnz(Numberdays);
disp('the number days for equinox ')
disp(numberofdays);
%c)
dn=1:1:365;
x=(360/365*(dn+284));
sdelta=23.45*(sind(x));
dni = [15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345] ;
sdeltai = interp1(dn,sdelta,dni);
disp(' dni sdeltai');
disp([dni',sdeltai'])
%PartB a)
for dn=100
for L=0
sdelta=7.53377356668594;
k=0.5:0.5:24;
lamda=15*(12-k);
PP=sind(sdelta).*sind(L)+cosd(sdelta).*cosd(L).*cosd(lamda);
Beta1=asind(PP);
end
for L=20
sdelta=7.53377356668594;
k=0.5:0.5:24;
lamda=15*(12-k);
PP=sind(sdelta).*sind(L)+cosd(sdelta).*cosd(L).*cosd(lamda);
Beta2=asind(PP);
end
for L=40
sdelta=7.53377356668594;
k=0.5:0.5:24;
lamda=15*(12-k);
PP1=sind(sdelta).*sind(L)+cosd(sdelta).*cosd(L).*cosd(lamda);
Beta3=asind(PP1);
end
for L=60
sdelta=7.53377356668594;
k=0.5:0.5:24;
lamda=15*(12-k);
PP2=sind(sdelta).*sind(L)+cosd(sdelta).*cosd(L).*cosd(lamda);
Beta4=asind(PP2);
end
for L=80
sdelta=7.53377356668594;
k=0.5:0.5:24;
lamda=15*(12-k);
PP3=sind(sdelta).*sind(L)+cosd(sdelta).*cosd(L).*cosd(lamda);
Beta5=asind(PP3);
end
figure(2)
grid on
plot(k,Beta1)
hold on;
plot(k,Beta2)
plot(k,Beta3)
plot(k,Beta4)
plot(k,Beta5)
hold off;
end
%b)
disp('dn=100')
disp(' Latitude degree,L' )
disp('============================================================')
disp('Solar time,k 0 20 40 60 80 ')
disp('============================================================')
disp([k',Beta1',Beta2',Beta3',Beta4',Beta5'])
%c)
for L=0
max(Beta1);
disp('max value at L=80')
disp(max(Beta1));
end
for L=20
max(Beta2);
disp('max value at L=20')
disp(max(Beta2));
end
for L=40
max(Beta3);
disp('max value at L=40')
disp(max(Beta3));
end
for L=60
max(Beta4);
disp('max value at L=60')
disp(max(Beta4));
end
for L=80
max(Beta5);
disp('max value at L=80')
disp(max(Beta5));
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Polygonal Shapes in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




