plotit(xi,yi,polyor​der,datastyle,fitst​yle)

버전 6.0.0.0 (11.5 KB) 작성자: Tom O'Haver
Simple function for plotting and fitting x,y data to polynomials, with error estimation.
다운로드 수: 338
업데이트 날짜: 2015/10/24

라이선스 보기

function [coef,RSquared,StdDevs,BootResults]=plotit(xi,yi,polyorder)
plotit accepts data in the form of a single vector, a pair of vectors,
"x" and "y", or a 2xn or nx2 matrix with x in first row or column. If the
input argument "polyorder" is supplied, it fits the data to a polynomial
of order "polyorder", plots the data in red dots and the fit as a blue
line, and displays the fit coefficients, their estimated standard deviations, and R-squared in the upper left
corner of the graph. Polyorder=1 for straight line, =2 for quadratic
(parabola) etc. If the 4th output argument (BootResults) is supplied,
computes coefficient error estimates by the bootstrap method and returns
the results in the matrix "BootResults" (of size 5 x polyorder+1). You
can change the number of bootstrap samples in line 48.
Tom O'Haver, In version 6 the syntax is [coef, RSquared, StdDevs] = plotit(x,y) or plotit(x,y,n) or optionally plotit(x,y,n, datastyle, fitstyle), where datastyle and fitstyle are optional strings specifying the line and symbol style and color, in standard Matlab convention.
Examples:
x=[1 2 3 4 5];y=[0 2 3 3 5];
plotit(y); % plot y only vs index number, no fit.
plotit(x,y); % plot x vs y only, data in separate vectors
plotit([x;y]); % plot data only, data in matrix with x in first row
plotit([x;y]'); % plot data only, data in matrix with x in first column
plotit(y,2); % plot y vs index and fit to second order polynomial
plotit(x,y,3); % plot x vs y and fit to third order polynomial
plotit([x;y],3); % plot and fit data in matrix
[coef, RSquared]=plotit([x;y],2) % return fit coefficients and r-squared
[coef,RSquared,STD]=plotit([x;y],2) Returns vector standard deviations
of coefficients as 'STD'. (STD./coef computes relative standard deviation)
[coef, RSquared,,StdDevs,BootResults]=plotit(x,y,polyorder) % computes
coefficient error estimates by the bootstrap method and returns the
results in the matrix "BootResults"

인용 양식

Tom O'Haver (2024). plotit(xi,yi,polyorder,datastyle,fitstyle) (https://www.mathworks.com/matlabcentral/fileexchange/48679-plotit-xi-yi-polyorder-datastyle-fitstyle), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
6.0.0.0

In version 6 the syntax is plotit(x,y) or plotit(x,y,n) or optionally plotit(x,y,n, datastyle, fitstyle), where datastyle and fitstyle are optional strings specifying the line and symbol style and color, in standard Matlab convention.

1.1.0.0

Corrected built-in help

1.0.0.0