Hi,I want to find maximum value from the plot of interpolation

조회 수: 6 (최근 30일)
Muhammad Usman
Muhammad Usman 2014년 4월 23일
편집: Muhammad Usman 2014년 4월 26일
clear all;clc;
rng(4);
x = [0.000000 2.038941 3.965975 5.988320 7.989983 10.024795 12.001537 14.023893 16.008968 18.002214 19.987403 22.001464 23.998955 26.021273 27.977311 29.498310];
y = [-0.000940 0.054940 0.124380 0.199366 0.297254 0.393073 0.500862 0.607698 0.714412 0.830266 0.945129 1.073882 1.156730 1.267062 1.289448 1.330006];
s = csaps(x,y);sn = fnxtr(s);
figure(2) % grid on; fnplt(s,[0 43],3),hold on,fnplt(sn,[0 29.5],0.5,'r',2); plot(x,y,'k-s')
here is the code with 2 arrays x and y,i interpolate it but i want to find the maximum value from the plot in blue,please help me, Thankx
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2014년 4월 23일
Hi Muahmmad,
Please edit your above question so that it is formatted as readable code. Use the {}Code button to do so.
I'm going to guess that the first plot you execute is the one that is coloured in blue, fnplt(s,[0 43],3). Is this the case? If so, then I suppose you could do something like:
[points,t] = fnplt(s,[0 43],3);
where, according to fnplt the values that would have been plotted by fnplt are returned in points. Then max(points) would then find the maximum value that you are looking for. (Of course, then you would have to manually plot the data afterwards.)
Geoff

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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