필터 지우기
필터 지우기

Extrapolation of data points

조회 수: 3 (최근 30일)
LB
LB 2016년 9월 23일
답변: Star Strider 2016년 9월 23일
Hi everyone.
I have calculated and plotted a set of x and y values. Let's say I have 20 points in my figure.
I want to use my first five point to extrapolate backwards to intercept the y-axis.
Can anyone help me with this?
Thank you :)

채택된 답변

Star Strider
Star Strider 2016년 9월 23일
I am not certain exactly what you want.
See if this works for you:
x = sort(rand(1, 20)); % Create Data
y = sort(rand(1, 20)); % Create Data
x_5 = x(1:5);
y_5 = y(1:5);
b = [ones(size(x_5(:))), x_5(:)]\y_5(:); % Estimate Parameters
y_int = b(1); % Y-Intercept
y_xtrp = [ones(size([0; x_5(:)])), [0; x_5(:)]]*b; % Create Line
figure(1)
plot(x, y, 'bp')
hold on
plot([0; x_5(:)]', y_xtrp', '--r')
hold off
grid

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by