Display only part of a plot?

I have fitted a curve to a data set with the fit funtion, see code below. In my graph I have the data points as well as the fitted function and would like display the function only up to a certain x-value (red arrow in figure). So that the last four points are still displayed but without the function intersecting them. Is that somehow possible??
c1 =[0.1000;
0.0750;
0.0500;
0.0250;
0.0100;
0.0090;
0.0080;
0.0070;
0.0060;
0.0050;
0.0040;
0.0030;
0.0020;
0.0010;
0.0005;
0.0001;
0.00001;
0.000001;
0]
d1=[46.5000;
46.4500;
47.5500;
46.9500;
47.0500;
48.6500;
48.9000;
49.0000;
51.0000;
51.9500;
58.3000;
62.1500;
66.5500;
68.1500;
71.1000;
71.4500;
71.1500;
70.9000;
70.2000]
f1 = fit(c1, d1, 'gauss3')
plot(f1, c1, d1)

 採用された回答

dpb
dpb 2018 年 7 月 18 日

1 投票

Yeah, but you have to evaluate the function over the range you want and use the results to do the plotting instead of the overloaded fit function-specific plot() routine--it doesn't have the option to not use the range of the data it was given for the prediction.
xhat=logspace(-6,-2); % 100 points log-spaced
yhat=f1(xhat); % evaluate at the points
semilogx(xhat,yhat,'r-',c1,d1,'b.') % plot the fit over range and all data points

2 件のコメント

jonas
jonas 2018 年 7 月 18 日
Much easier than my solution, nice!
AWi
AWi 2018 年 7 月 18 日
Perfect, thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInterpolation についてさらに検索

製品

リリース

R2018a

質問済み:

AWi
2018 年 7 月 18 日

コメント済み:

AWi
2018 年 7 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by