Listing values for a specific harmonic line from waterfall figure
4 views (last 30 days)
Show older comments
Hello dear Matlab team,
I would like to ask you how to gate listing values for a specific harmonic line from waterfall figure?
I have this waterfall figure below:

It is transpose to imagesc see in following figure:

And I would like to ask you how I can data for specific harmonic line in this figure?
Thank you,
Best regards,
Jan
0 Comments
Answers (1)
Star Strider
on 29 Aug 2025
Edited: Star Strider
on 29 Aug 2025
By 'harmonic line', I assume you intend frequency, the x-axis coordinate in each plot. A waterfall plot is a specific depiction of a matrix. I use surf here for convenience.
If the one you want matches exactly a frequency in plot, and the frequencies map to the x-axis coordinate exactly (as the columns of the plotted matrix), you can probably just use 'logical indexing' to get them.
However, the easiest way woukld be to use the scatteredInterpolant function. The desired frequency can be anything with in the frequency range. The lines can either be constant with respect to one variable, or vary, as depicted by the 'Diagnoal Line' drawn here. I drew 'DiagonalLine' as a linear relation between 'Frequency' and 'Rotor Speed', however it does not havve to be linear and can be anything that works with the original data.
Example --
rsv = (0:0.5:8).';
frqv = (0:0.5:10).';
[Fm,RSm] = ndgrid(frqv, rsv);
Data = exp(-((Fm-2).^2/4.5+(RSm-6).^2)/3.5);
% disp(Data)
FRS = scatteredInterpolant(Fm(:), RSm(:), Data(:))
RotorSpeed_Frequency_2pi = FRS(frqv, ones(size(frqv))*2*pi)
RotorSpeed_Frequency_pi = FRS(frqv, ones(size(frqv))*pi)
RSvF = frqv*1.1 + 0.5;
DiagonalLine = FRS(frqv, RSvF)
figure
surf(Fm, RSm,Data, FaceAlpha=0.4, EdgeAlpha=0.5, DisplayName='Frequency-Rotor Speed Surface')
xlabel('Frequency')
ylabel('Rotor Speed')
colormap(turbo)
hold on
plot3(frqv, ones(size(frqv))*pi, RotorSpeed_Frequency_pi, '-b', LineWidth=2, DisplayName='Frequency=\pi')
plot3(frqv, ones(size(frqv))*2*pi, RotorSpeed_Frequency_2pi, '-r', LineWidth=2, DisplayName='Frequency=2\pi')
plot3(frqv, RSvF, DiagonalLine, '-m', LineWidth=2, DisplayName='Diagonal Line')
hold off
legend(Location='best')
axis([0 10 0 8])
view(50,45)
.
EDIT -- (29 Aug 2025 at 17:01)
Added 'Diagonal Line', added to discussion, tweaked code.
.
4 Comments
Star Strider
on 1 Sep 2025
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



