MATLAB Answers

Multiple 2D plots in 1 3D plot

44 views (last 30 days)
Max Mortensen
Max Mortensen on 22 Feb 2021
Commented: Max Mortensen on 23 Feb 2021
I have 3 sets of data accross 3 days. In the y direction would be day 1, 2, 3. The x-direction has specific times t. while the Z direction is the intesitiy at time t. No equations just 3 sets of data with time t. See below for example of the data.
t is the time. BY is day 1's intensities, CY is day 2's intensities, and DY is day 3's intensities.
In the end I want the data to look like the example from orgin attached as a figure.
Thank you, I have tried many different things but cannot quite figure out how to get plot3 to work out.
t=[1
2
3
4
5
6
7
8
9];
BY = [4925
4564
4356
4245
3701
3662.5
3510.5
3520.5
3342];
CY = [4865.875
4657.5
4474
4221.5
4079.75
3907
3700.5
3579.25
3460.375];
DY = [421.125
416.625
446.25
423.875
429.25
398.75
379.875
374.5
357.25
340
343.25
338.625];
  2 Comments
Max Mortensen
Max Mortensen on 22 Feb 2021
Yes, the origin plot is the orignal data and each day has more than 5000 points starting from minute 4 going all the way up to minute 60. The data I provided was a small portion with time t asigned as an arbitrary 1-9 but really it should be
t=[4
4.01
4.02
4.03
4.04
4.05
4.06
4.07
4.08];
sorry for the confusion

Sign in to comment.

Accepted Answer

dpb
dpb on 22 Feb 2021
Well, your data look nothing at all like those in the sample plot and your vectors aren't of commensurate lengths, but--
plot3(t,ones(numel(t),2).*[0 1],[BY,CY]);
grid on
t1=1:numel(DY);t1=t1.';
hold on
plot3(t1,ones(size(t1)).*[2],[DY])
ylim([-0.5 2.5])
yticks(0:2)
set(gca,'YTickLabel',num2str([0:2].','Day %d'))
results in
It takes rotating around to get the orientation from default and will need cleaning up, but that's the basis to get the data on a 3D grid.
  1 Comment
Max Mortensen
Max Mortensen on 23 Feb 2021
Thank you for your help, I didn't want to put the acutal data on here being that each day has 4000+ data points. But this has helped me. Thank you.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!