How to predict using interpolation or polyfit
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mekala balaji
el 13 de Sept. de 2017
Respondida: Akira Agata
el 13 de Sept. de 2017
Hi, I have data as below:
x y 1.2 2.3 4.8 2.7 5.8 3.5
and I want to predict for x is 2.7, what is y? Many thanks in advance,
1 comentario
KSSV
el 13 de Sept. de 2017
YOu have given only one value....provide both x and y....read about interp1
Respuesta aceptada
Akira Agata
el 13 de Sept. de 2017
...Or polyfit function, like:
xy = [1.2, 2.3;
4.8, 2.7;
5.8, 3.5];
p = polyfit(xy(:,1), xy(:,2), 2);
x = linspace(0,6);
y = polyval(p, x);
figure
plot(xy(:,1), xy(:,2),'ro');
hold on;
plot(x,y,'b:');
plot(2.7, polyval(p, 2.7), 'bo');
legend({'Data','polyfit','estimated value at x = 2.7'});

0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Multirate Signal Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!