Filter löschen
Filter löschen

Extrapolation of data points

3 Ansichten (letzte 30 Tage)
LB
LB am 23 Sep. 2016
Beantwortet: Star Strider am 23 Sep. 2016
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 :)

Akzeptierte Antwort

Star Strider
Star Strider am 23 Sep. 2016
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

Weitere Antworten (0)

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by