Azzera filtri
Azzera filtri

Extrapolation of data points

3 visualizzazioni (ultimi 30 giorni)
LB
LB il 23 Set 2016
Risposto: Star Strider il 23 Set 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 :)

Risposta accettata

Star Strider
Star Strider il 23 Set 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

Più risposte (0)

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by