how can i create a 3d-plot from a matrix?

4 views (last 30 days)
Hi guys, i trying to create a 3d-plot or a waterfall-plot from an excel-table but i cant do it.
Maybe y could help me!.
The problem is that i have 3 variables: Time, frequency and soundpressure (SPL) y can take a look into the attachment.
could y tell me how to make it?
i thank y a lot!
Regards
Nico.
  2 Comments
Walter Roberson
Walter Roberson on 7 May 2019
You have 13 header lines.
Your 14th header line starts with 'Hz' and has a number of values listed after that without indication of meaning. Are those times?
Line 15 to 45 appears to start with a frequency and have a number of readings after that. Are those SPL corresponding to the times from line 14 ?
You have semi-colon delimited values with comma as the decimal separator.
It appears that at higher frequencies you have fewer entries per line.
Nicolas Ippoliti
Nicolas Ippoliti on 7 May 2019
Hi Walter, thanks for your answer!.
Yes, under Hz is the frequenz, after Hz (to the right) its the time (from 0,0098114 s to 13,9941864 s) and between the SPL at this time and at the respectly Frequency band (1/3 Octave).
i tried to resolve it with meshgrid but i couldn't completely understand how its work.
Thank you again!
Regards

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 8 May 2019
I have attached code.
The data was messier than it looked. There were two half-tables side by side, same times and same frequencies, but with ranges that are somewhat different. The code plots them in different plots, variables SPL1 and SPL2 .
You might want to set YScale to log for the plots, since the frequences increase on a log scale (looks like 10*log10(4) as the exponent)
For the first plot, it is meaningful to set the Z scale to log, as all of the values are positive except for one 0.
For the second plot, there are a number of negative values, so it does not make sense to use log scale.
The top left point in the right hand set of data comes across as exactly 65535 . I was pretty sure that was an indicator of invalid data, so I set that to nan.
  2 Comments
Nicolas Ippoliti
Nicolas Ippoliti on 8 May 2019
Hi Walter,
first i want to thank y very much for your support!
the script works propertly. and would know if it posible to have a terz frequency distribution or a octave, i tried to do it over the tick configuration but it is not good as well visible.
i really admire people like you, who is supporting other people.
Thanks a lot, and sorry for my bad English.
Have a nice day!
Walter Roberson
Walter Roberson on 8 May 2019
I am not sure what a terz frequency distribution is, or an octave for this purpose? Do you want the frequency axes to be labeled with log2 of the frequency?

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!