Plot points with the spectra

조회 수: 4 (최근 30일)
Ductho Le
Ductho Le 2021년 1월 14일
답변: Anudeep Kumar 2025년 5월 15일
I have a set of points and their amplitudes. I want to plot a graph like this (fig bellow) in which amplitudes are plotted as the spectra of every points.
I plot the graph with command:
plot(f,pv,'k.') % f: frequency; pv: phase velocity
Could you help me to impose amplitude to this plot.
Thanks in advance.

답변 (1개)

Anudeep Kumar
Anudeep Kumar 2025년 5월 15일
Hey Ductho,
I believe the function ‘scatter’ can help you achieve your goal. The 'scatter' function comes with the option of specifying the circle colors, which can be a single color or an array , like in your case. You can also specify your circles to be filled.
Below is a short snippet on how to:
% Example data (replace with your own)
% f = ...; % Frequency array
% pv = ...; % Phase velocity array
% amp = ...; % Amplitude array
scatter(f, pv, 20, amp, 'filled'); % 20 is the marker size, adjust as needed
colormap(jet); % Choose colormap (e.g., jet, parula, hot, etc.)
colorbar; % Show colorbar
xlabel('Frequency (MHz)');
ylabel('Phase Velocity (km/s)');
title('Amplitude Spectra');
Please refer to the ‘scatter’ documentation to further explore the possibilities and modify your code as per your need
Hope that helps!

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by