# i am new to matlab and i want to learn, can anyone help me with this please!!!

2 visualizzazioni (ultimi 30 giorni)
Anas Gharsa il 22 Gen 2022
Commentato: Anas Gharsa il 25 Gen 2022
I want to write a script which produces the polynomial interpolating the function f(x) = sin(4x) at the points x0 = 1, x1 = 3, x2 = 3.5, x3 = 4.0 by using the Lagrange form of the interpolating polynomial!!!!!!
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Anas Gharsa il 22 Gen 2022
thank you so much!!
Anas Gharsa il 25 Gen 2022
this is what i did
x= [0.9 1.5 2.4 2.6 2.8 3.1 3.5 3.8];
y= [1.0 0.8 1.3 6.2 9.3 6.0 2.1 -0.5];
plot(x,y,'ro');
hold on
p1 = polyfit(x,y,2);
coefficients = polyfit(x, y, 2);
yFit = polyval(coefficients, 2.5);
but it shows like this
why ??did i do something wrong ??

Accedi per commentare.

### Risposta accettata

KSSV il 22 Gen 2022
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Anas Gharsa il 22 Gen 2022
that was helpful, thank you so much

Accedi per commentare.

### Categorie

Scopri di più su Interpolation in Help Center e File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by