Create a 3D plot with shadow length, altitude, and time.

Dear experts;
I would like to create a nice 3D plot with variables shadow length, altitude, and Time. I attached my code and the data here along with a sample plot that I would like to have.
Your help will be greatly appriciated

2 Comments

I don't see the sample plot. Can you attach it?
Hi Voss,
I attached the sample plot here. Thank you!

Sign in to comment.

 Accepted Answer

Filling the inside of the 3D curve is straightforrward —
run('shadecode.mlx')
T1 = readtable('Shadedata.xlsx')
T1 = 40×4 table
Time Altitude ShadowLength ShadowLength_m _______ ________ ____________ ______________ 0.32292 1.34 616.16 2135.8 0.33333 2.34 238.74 808.83 0.34375 3.34 147.03 495.25 0.35417 4.34 106.39 357.42 0.36458 5.34 83.6 280.44 0.375 6.34 69.07 231.5 0.38542 7.34 59.05 197.77 0.39583 8.34 51.74 173.22 0.40625 17.92 46.21 154.65 0.41667 19.63 41.9 140.22 0.42708 21.22 38.49 128.79 0.4375 22.68 35.76 119.62 0.44792 24.02 33.55 112.22 0.45833 25.2 31.76 106.24 0.46875 26.24 30.33 101.45 0.47917 27.11 29.21 97.68
t = T1.Time;
Alt = T1.Altitude;
SL = T1.ShadowLength;
SLm = T1.ShadowLength_m;
figure
plot3(Alt, SL, t)
hold on
patch([Alt flip(Alt)], [SL flip(SL)], [t flip(t)], [0 0 0]+0.5, 'FaceAlpha',0.5)
hold off
grid on
xlabel('Altitude')
ylabel('Shadow Length')
zlabel('Time')
Filling the outside is not.
.

6 Comments

Thank you, Star Strider;
My bad I thought I attached the sample plot I would like to have. I attached it here, can you take a look at it?
I’m lost.
figure
imshow(imread('3D.JPG'))
It is not obvious to me how to calculate ‘Aspect’ and ‘Slope’ from the available data. The ‘Slope’ could be inferred from ‘shadow length’ (if the tree height was available, since it’s likely the arctangent of the tree height divided by the shadow length), however ‘Aspect’ is undefined. How does ‘Time’ relate to all of it?
It seems to me that you would have to have several of these files to create a surface plot, concatenating the ‘shadow length’ vectors into a matrix (assuming thy all had the same lengths and were recorded at the same times, or could be interpolated to the same times).
.
You are right, I thought I could have my plot shape like that.
Could you fix the hourly values in the axis "Time" to make it look the same as the one in 2D plot I created.
Thanks,
Try this —
% run('shadecode.mlx')
T1 = readtable('Shadedata.xlsx')
T1 = 40×4 table
Time Altitude ShadowLength ShadowLength_m _______ ________ ____________ ______________ 0.32292 1.34 616.16 2135.8 0.33333 2.34 238.74 808.83 0.34375 3.34 147.03 495.25 0.35417 4.34 106.39 357.42 0.36458 5.34 83.6 280.44 0.375 6.34 69.07 231.5 0.38542 7.34 59.05 197.77 0.39583 8.34 51.74 173.22 0.40625 17.92 46.21 154.65 0.41667 19.63 41.9 140.22 0.42708 21.22 38.49 128.79 0.4375 22.68 35.76 119.62 0.44792 24.02 33.55 112.22 0.45833 25.2 31.76 106.24 0.46875 26.24 30.33 101.45 0.47917 27.11 29.21 97.68
t = T1.Time;
th = hours(t*24);
th.Format = 'hh:mm';
Alt = T1.Altitude;
SL = T1.ShadowLength;
SLm = T1.ShadowLength_m;
figure
plot3(Alt, SL, th)
hold on
patch([Alt flip(Alt)], [SL flip(SL)], [t flip(t)], [0 0 0]+0.5, 'FaceAlpha',0.5)
hold off
grid on
xlabel('Altitude')
ylabel('Shadow Length')
zlabel('Time')
zt = zticks;
zticks(hours(8 : 2 :16))
.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!