Plot a curve with coordinates

조회 수: 13 (최근 30일)
Sterre Triezenberg
Sterre Triezenberg 2019년 6월 22일
답변: Star Strider 2019년 6월 22일
Hi!
I determined the peaks of my data. If I plot it, I just get those peaks, but I need a curve through those points.
This is how I determine the peaks:
[Minima indexminima1] = findpeaks(-BoSMax1);
[Maxima indexmaxima1] = findpeaks(BoSMax1);
Pieken1 = [indexminima1 indexmaxima1];
sort(Pieken1);
BoSMax11= zeros(size(t));
BoSMax11(Pieken1) = BoSMax1(Pieken1);
Can someone please help me?

답변 (1개)

Star Strider
Star Strider 2019년 6월 22일
Without knowing what your data are, this will plot the peak and valley values as a functions of the indices:
figure
plot(indexminima1, -Minima)
hold on
plot(indexmaxima1, Maxima)
hold off
grid
Those should produce plots with straight lines connecting the maxima and another connecting the minima.
If you want to estimate the parameters of a function fitted to those points, there are several options, depending on your data and the functions you want to fit to them.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by