How to replicate this graph
4 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to replicate the attached graph. I am given a data set with 25 rows of x,y values.
These are the requirements for the curves:
Given a set of 25 data points, create a graph that shows five fitted curves where for each curve, 5/25 points are left out. Also on this graph, show the 25 points. This means that the five curves would be based on the following 5 data sets:
Curve Number
1 2 3 4 5
Curve Fitted on Points (respectively)
6-25, 1-5, 11-25, 1-10, 16-25, 1-15, 21-25, 1-20
Accuracy Check Points (respectively)
1-5, 6-10, 11-15, 16-20, 21-25
1 件のコメント
dpb
2021 年 11 月 25 日
Not much to that, look at the doc for plot for examples...you will need hold on
回答 (1 件)
Shanmukha Voggu
2021 年 12 月 1 日
Hi Jaime,
I understood you want to plot the curves in addition to the points, this can be achieved by using multiple plot functions and having hold on statements between them.
Lets plot all 25 points, I am assuming x and y are 25x1 matrices
plot(x,y,'co');
Lets Truncate 5 points in the middle (exlude 6-10 points in the data for plotting one curve)
x1=[x(1:5);x(11:25)];
y1=[y(1:5);y(11:25)];
hold on; % retains plots in the current axes so that new plots added to the axes do not delete existing plots
f1=fit(x1,y1,'poly2'); % Quadratic polynomial curve, one can use other ways to fit as well
plot(f1); % plot the curve
Add plots of other curves as mentioned above
% can use plot functions here for other curves
% by changing the data as shown above
hold off; % removes the constraint that is imposed by "hold on"
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Fit Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!